Change workgroup name via script on a PC

Change workgroup name via script on a PC

I need to create a computer script that I can use to change the workgroup name on a PC and make the script flexible so it can be used for different workgroup names.  I need to be able to specify the workgroup name when I create the task and it appears the DC Script Argument field is the place to do this.  

FYI...We have no AD joined workstations.

I can execute this command below change the workgroup name to "GRAY-EXT".  The workgroup name change requires a reboot but that is straightforward and I know how to do this with the Shutdown command.

      Wmic computersystem where name="%computername%" call joindomainorworkgroup name=”GRAY-EXT”

I need to replace "GRAY-EXT" with something like "%1" and pass the argument for %1 to the script via the DC Script Arguments line when I create the task.  I have not been successful doing this and I have not located examples in the DC docs or forums where this was done.

I am not experienced with VBS scripting either so any help to get this accomplished via batch command or VBS will be much appreciated.

Mike Gerst

                  New to ADSelfService Plus?