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
ArborDev
Engaged Sweeper
NICE! Thanks.
ejensen
Engaged Sweeper III
probably the permissions you have to setup in IE, check the documentation, I know without this you cannot execute any of the other custom actions. Look for activeX in the docs, it shows you how.
tcostella
Engaged Sweeper
Great idea!!

Cannot get it to run from website on server or client PC. I can get "cmd.exe /K \\atm04\winapp$\LanSweeper\ComputerDescriptionChange.vbs MYPCNAME" to work just fine...

Hmm....

Any idea's why?

Thanks,

Thad
Andreasl
Engaged Sweeper
Hello,

I bring this to work in IE7 and with the following action:
cmd.exe /K \\COMPUTER\SHARE\change_comp_desc.vbs {computer}

I must remove the cscript and must add /K to cmd.exe . You can also use /C instead of /K if you like to close the windows if the job is done.
After calling this in the browser I get the trust warning and be able to set the description on XPpro workstations and Win2K3 Server.

/update
I test it on Win2K machines too. It seems that the script put the description in. I can fin it in the registry under [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\lanmanserver\parameters]] in the key srvcomment. I remove my testcomputer from lansweeper, reboot my testcomputer to take effect of the changes and after booting I run lsclient again. The computer comes up in Lansweeper but the description field in Lansweeper is still empty.

/update 2
on some computer it begin to work. I'm not sure what blocks some of them. I will dig a little bit more.

Thanks for sharing this action

Regards
Andreas
ejensen
Engaged Sweeper III
No worries jreimer, i actually did the exact same thing at first. i couldnt figure out why it wasnt updating. 🙂
jreimer1
Engaged Sweeper
Thanks you trick worked.

Goes away with head between legs.
ejensen
Engaged Sweeper III
glad to be able to share. Another thought i had about this script is that with WMI sometimes you have to use impersonation due to security warnings. so if anyone is having problems running this script, they may have to do that. i can provide some help if that need arises.
Eric
Hemoco
Lansweeper Alumni
Also note that you need to have administrative permissions on the client computer when running this script.

Thanks ejensen for the script, it's really valuable.
ejensen
Engaged Sweeper III
it wont show in the web page until the next scan. I would run it against your own computer and then verify the change by right-clicking the my computer icon and going to the computer name tab.
jreimer1
Engaged Sweeper
I have done everything with this script as you put it, but when i enter the description in the box nothing happens. Doesn't update even tried a refresh of page.