Link to home
Start Free TrialLog in
Avatar of Walt Forbes
Walt ForbesFlag for Bahamas

asked on

How to convert a CMD script to a VBS script

I want the following command to be placed in a VBS file: "net localgroup Administrators /add "Domain\Group" ".
How should I format the VBS file to execute the "net localgroup" command given above?
ASKER CERTIFIED SOLUTION
Avatar of johnnash1180
johnnash1180
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Walt Forbes

ASKER

Nothing happens when I execute the script (neither double-click nor CSCRIPT at the command prompt works).
The JPEG shows 4 dialog boxes: the Active Directory group, the VBS script file contents, the 'null' result when CSCRIPT is used at the command prompt, and the unchanged contents of the local "Administrators" group.

VBS-Script-NoExecute.JPG
The single syntax error was the double back-slash (\\) after the "Domain" name - it should be a single back slash as in the base command (net localgroup Administrators /add Domain\Group).
I should have picked this up, but I thought that VBScripting the command somehow required the double back-slash.
Nonetheless, I declare this to be the solution!