cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
ejensen
Engaged Sweeper III
Here is a custom action I setup so that we can change the computer description.
cmd.exe cscript \\SERVER\SHARE\change_comp_desc.vbs {computer}


and here is the VBscript code:

Set WshNetwork = WScript.CreateObject("WScript.Network")

strComputer = Wscript.Arguments.Item(0)
strDescription = Inputbox("Enter Description:")

Set Obj= GetObject("winmgmts:\\" & strComputer).InstancesOf("Win32_OperatingSystem")
For Each x In Obj
x.Description = strDescription
x.Put_
Next

WScript.Quit


Pops up an input box for you to enter the computer description.
Please let me know if anyone sees anything that could be improved with this script or custom action.

thanks,
Eric
31 REPLIES 31
ifm
Champion Sweeper
I want to automatically set the local computer description to the same description as is used in the AD, is this possible?
kaarde
Engaged Sweeper III
ifm wrote:
I want to automatically set the local computer description to the same description as is used in the AD, is this possible?


Same here, anyone know how?
loerdy
Engaged Sweeper
im using the srvmgr.exe from the w2k3 ressource kit.
you can call:

srvmgr.exe \\{computer}

works with NT4, W2k, W2k3 ( Vista not checked )

loerdy
DGoodwin
Engaged Sweeper
Just for kicks we did this here: changes the current description to the computer name. We added it to our logon scripts and are in process of adding it to the custom actions. Hopefully it helps someone out.

chgdesc.vbs

Set WshNetwork = WScript.CreateObject("WScript.Network")
Set WshShell = CreateObject("wScript.Shell")

Dim objSWbemServices,colSWbemObjectSet,objSWbemObject
Set objSWbemServices = GetObject("winmgmts:\\.\root\cimv2")
Set colSWbemObjectSet = objSWbemServices.InstancesOf("Win32_OperatingSystem")

For Each objSWbemObject In colSWbemObjectSet
objSWbemObject.Description = WshNetwork.ComputerName
On Error Resume Next
objSWbemObject.Put_
Next
qbicdesign
Engaged Sweeper
I get the description field popup, but after i enter the description and hit OK, the cmd window closes after a few seconds and the Computer Description doesn't get changed. I even restarted the pc that was supposed to change, and rescanned with LS.
The script is located on our netlogin share.
any ideas?
rmorgan
Engaged Sweeper
Problem solved, never mind.
rmorgan
Engaged Sweeper
Looks like a grate custom action.
I have a problem, when I try to execute the script I am getting the following error:

Msg 102, Level 15, State 1, Line 1
Incorrect syntax near '='.


Anyone have a clue as too what I am doing wrong?

Thanks...
james_mitchell
Engaged Sweeper II
Handy little script.

Nifty tool, Could you be kind enough to make a script that changes the computer name ? 🙂


Changing computer name while the computer is currently part of a domain can cause some issues it is always recommended to remove the computer from the domain, rename, put computer back on domain.

If you where to implement this I would recommend using AdminAutoLogon and RunOnceEx
Ismail
Engaged Sweeper II
Nifty tool, Could you be kind enough to make a script that changes the computer name ? 🙂
DSenette
Engaged Sweeper
hmm for some reason i can't get any of this to work..

with the CMD i can get it to pop up the command window...but it will never pop up with the msg box to let me input the description...any ideas?