Lansweeper logo
Home Download Features Demo Buy now Help Support forum
 
    Most requested support articles:
  Lansweeper troubleshooting guide.
  The RPC server is unavailable. (Exception from HRESULT: 0x800706BA)
  WMI Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
  How to configure the windows firewall using group policies.
  Support:  
 support@lansweeper.com  
Skype: Lansweeper  
  Mo-Fri 9h-17h CET  
Welcome Guest Search | Active Topics | Log In | Register

2 Pages12>
Tag as favorite
Change the computer description
ejensen
#1 Posted : Monday, May 05, 2008 9:49:53 PM

Rank: Premium user

Groups: Premium Users, Member
Posts: 43
Location: Ohio, USA
Here is a custom action I setup so that we can change the computer description.
Code:
cmd.exe cscript \\SERVER\SHARE\change_comp_desc.vbs {computer}


and here is the VBscript code:

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
Optilan
#2 Posted : Tuesday, May 06, 2008 12:42:43 PM

Rank: Premium user

Groups: Member, Premium Users
Posts: 12
Location: UK
That's a really good idea, why didnt i think of it!

I got it to work but i needed to change the following:

strComputer is defined at the top as strCOmputer.

Also i needed to change the Action to just begin with cscript and strip off the cmd.exe for some reason, i know it shouldnt make any difference, but just incase anyone else gets the same problem, it was just bringing up the command prompt before i changed it.

Thanks for this ejensen.
Optilan Communication Systems
www.optilan.com
ejensen
#3 Posted : Tuesday, May 06, 2008 4:16:07 PM

Rank: Premium user

Groups: Premium Users, Member
Posts: 43
Location: Ohio, USA
yeah, sorry about the type-o there. i fixed it in the original post.

interesting that you had to strip out the cmd.exe, mine works fine. wonder how others will be effected.
jreimer
#4 Posted : Tuesday, May 06, 2008 8:00:42 PM
Rank: Freeware Member

Groups: Member
Posts: 34
Location: Ellenville, NY
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.
ejensen
#5 Posted : Tuesday, May 06, 2008 8:23:03 PM

Rank: Premium user

Groups: Premium Users, Member
Posts: 43
Location: Ohio, USA
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.
Lansweeper
#6 Posted : Tuesday, May 06, 2008 8:46:04 PM

Rank: Administration

Groups: Administration, Premium Users
Posts: 10,007
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
#7 Posted : Tuesday, May 06, 2008 8:55:10 PM

Rank: Premium user

Groups: Premium Users, Member
Posts: 43
Location: Ohio, USA
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
jreimer
#8 Posted : Tuesday, May 06, 2008 9:55:32 PM
Rank: Freeware Member

Groups: Member
Posts: 34
Location: Ellenville, NY
Thanks you trick worked.

Goes away with head between legs.
ejensen
#9 Posted : Tuesday, May 06, 2008 10:36:10 PM

Rank: Premium user

Groups: Premium Users, Member
Posts: 43
Location: Ohio, USA
No worries jreimer, i actually did the exact same thing at first. i couldnt figure out why it wasnt updating. :)
Andreasl
#10 Posted : Wednesday, July 09, 2008 3:25:21 PM
Rank: Freeware user

Groups: Member
Posts: 4
Location: Germany
Hello,

I bring this to work in IE7 and with the following action:
Quote:
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
tcostella
#11 Posted : Monday, August 04, 2008 10:39:56 PM

Rank: Premium user

Groups: Member, Premium Users
Posts: 3
Location: Tempe, AZ
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
ejensen
#12 Posted : Tuesday, August 05, 2008 6:29:56 PM

Rank: Premium user

Groups: Premium Users, Member
Posts: 43
Location: Ohio, USA
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.
ArborDev
#13 Posted : Tuesday, August 12, 2008 6:51:12 PM

Rank: Premium user

Groups: Member, Premium Users
Posts: 2
Location: Bath, NY, United States
NICE! Thanks.
DSenette
#14 Posted : Thursday, August 28, 2008 3:19:09 PM

Rank: Premium user

Groups: Premium Users
Posts: 15
Location: USA
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?
Ismail
#15 Posted : Monday, October 20, 2008 11:53:43 AM

Rank: Premium user

Groups: Member, Premium Users
Posts: 36
Location: Kuwait
Nifty tool, Could you be kind enough to make a script that changes the computer name ? :)
Users browsing this topic
Guest
2 Pages12>
Tag as favorite
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Contact: E-mail Lansweeper - Skype : Lansweeper
Copyright 2004 - 2011 © Hemoco bvba