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
smcmoran
Engaged Sweeper
Anyone,

I keep getting the following error -

Microsoft (R) Windows Script Host Version 5.8
Copyright (C) Microsoft Corporation. All rights reserved.

Y:\change_comp_desc.vbs(17, 9) Microsoft VBScript compilation error: Expected e
d of statement

Tried it with all of the different variables in the post, cscript, cmd.exe, etc but I never get the pop up and simply this error when I run directly from the cmd window.

Any ideas? What am I doing wrong?

Thanks
noelJCD
Engaged Sweeper
can anyone help
I am getting the attached error message when I run this.
Susan_A
Lansweeper Alumni
noelJCD wrote:
can anyone help
I am getting the attached error message when I run this.

This action requires administrative privileges on the target computer. Actions are run in the security context of the user initiating the action, so the user initiating the action must have administrative privileges on the target computer. You can use runas to run an action as a different user.

Do keep in mind that we cannot provide further support for third-party actions or installers.

noelJCD
Engaged Sweeper
This works like a treat
Great Action.
LucBau
Engaged Sweeper
Awesome ! Exactly what I was looking for. Works great without the cmd.exe for me.

Thanks !
Bulwinkle
Engaged Sweeper
so I get an error when I run this after the input box when I click "OK"

Line:9
Char:4
Error: Access denied
Code: 80041003
Source: SWbemObjectEx

is this a permissions issue?
what can I do to progam elevated permissions?

char #4 is in red below

line 7 For Each x In Obj
line 8 x.Description = strDescription
line 9 x.Put_
Next
romwarrior
Engaged Sweeper
Thanks OP for this! I had to do it like this for it to work:

cscript {actionpath}change_comp_desc.vbs {computer}
MCanning
Engaged Sweeper

{actionpath}change_comp_desc.vbs \\{computer}

works for me, no cmd window just the run app dialog box.
telesphere
Engaged Sweeper
The first post of this thread that provides the script and text for the custom action works like a champ on Windows 7 Business and Vista Business machines on a Windows 2003 domain.

Thanks for your work on this!



//Update:

Just for clarification...I put the script in my Actions directory on the LS server and used the exact action text provided. I then ran the action via FireFox 3.6.8 from a Windows 7 computer connected over VPN on a different VLAN. NO PROBLEMS. WORKED GREAT!

Not sure why others are having problems??? But this was 2 years ago so perhaps its working for them now.
~~\\\TNLADMIN///~~ "Life moves pretty fast. If you don't stop and look around, you can miss it." -Ferris Bueller