Home | Download | Demo | Feature list | Premium users | Support | Knowledgebase
How to fix WMI Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
The network path was not found - The RPC server is unavailable. (Exception from HRESULT: 0x800706BA)
How to configure Windows Vista clients.
How to configure the windows firewall using group policies.
   
Welcome Guest Search | Active Topics | Members | Log In | Register

Change the computer description Options
ejensen
Posted: Monday, May 05, 2008 9:49:53 PM
Rank: Freeware Member
Groups: Member

Joined: 5/2/2008
Posts: 26
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
Posted: Tuesday, May 06, 2008 12:42:43 PM

Rank: Premium user
Groups: Member , Premium Users

Joined: 1/24/2008
Posts: 13
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
Posted: Tuesday, May 06, 2008 4:16:07 PM
Rank: Freeware Member
Groups: Member

Joined: 5/2/2008
Posts: 26
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
Posted: Tuesday, May 06, 2008 8:00:42 PM
Rank: Freeware Member
Groups: Member

Joined: 5/6/2008
Posts: 17
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
Posted: Tuesday, May 06, 2008 8:23:03 PM
Rank: Freeware Member
Groups: Member

Joined: 5/2/2008
Posts: 26
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
Posted: Tuesday, May 06, 2008 8:46:04 PM

Rank: Administration
Groups: Administration

Joined: 2/10/2005
Posts: 1,451
Location: Hamme Belgium
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
Posted: Tuesday, May 06, 2008 8:55:10 PM
Rank: Freeware Member
Groups: Member

Joined: 5/2/2008
Posts: 26
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
Posted: Tuesday, May 06, 2008 9:55:32 PM
Rank: Freeware Member
Groups: Member

Joined: 5/6/2008
Posts: 17
Location: Ellenville, NY
Thanks you trick worked.

Goes away with head between legs.
ejensen
Posted: Tuesday, May 06, 2008 10:36:10 PM
Rank: Freeware Member
Groups: Member

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

Joined: 7/9/2008
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
Users browsing this topic
Guest


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.


Copyright © 2003-2006 Yet Another Forum.net. All rights reserved.

   
Quick links: Download - Premium users - Support 
Copyright 2004 - 2008 © Geert Moernaut - Hemoco bvba - All rights reserved