Sign in to follow this  
Followers 0
E1M1

does anyone know how to to make script that changes workgroup?

8 posts in this topic

does anyone know how to to make script that changes workgroup?

I prefer regedit or command line method.


edited

Share this post


Link to post
Share on other sites



I have done it by going thru My Computer. - but not by command line or registry.

Share this post


Link to post
Share on other sites

Google your problem (rename workgroup command line). You can use netdom.exe from windows Server 2003 to rename a computer with a command line. you may have to install it on each computer. I have not tried this method - YMMV.

Share this post


Link to post
Share on other sites

What i do is Fileinstall() NetDom.exe and then use the :

$path="netdom join "& @ComputerName & " /domain:mydomain /userd:adminuser /passwordd:adminpassword"
RunWait(@ComSpec & ' /c ' & $path)

This is the domainjoin. You can type "netdom /?" in cmd to check for workgroup.

Share this post


Link to post
Share on other sites

What i do is Fileinstall() NetDom.exe and then use the :

$path="netdom join "& @ComputerName & " /domain:mydomain /userd:adminuser /passwordd:adminpassword"
RunWait(@ComSpec & ' /c ' & $path)

This is the domainjoin. You can type "netdom /?" in cmd to check for workgroup.

Hi,

here is the WMI Solution:

$strComputer = "localhost"
$newworkgroup = "WORKGROUP"

$objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2")
For $computersystem In $objWMIService.InstancesOf("Win32_ComputerSystem")
    $computersystem.JoinDomainOrWorkgroup ($newworkgroup)
Next

You have to reboot machine to make changes effect.

;-))

Stefan

Share this post


Link to post
Share on other sites

Thanks Stefan - I also found out how to rename the computer through WMI using $computersystem.Rename($newcompname) , but what about the Computer Description? How can that be changed?

Share this post


Link to post
Share on other sites

Thanks Stefan - I also found out how to rename the computer through WMI using $computersystem.Rename($newcompname) , but what about the Computer Description? How can that be changed?

Hi,

$strComputer = "localhost"
$strNewdescription = "Test"
$objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2")
For $objitem In $objWMIService.InstancesOf("Win32_OperatingSystem")
    $objitem.Description =$strNewdescription
    $objitem.Put_ ()
Next

or alternate

RegWrite ("HKLM\SYSTEM\CurrentControlSet\Services\Lanmanserver\parameters", "srvcomment", "REG_SZ", $strNewdescription)

;-))

Stefan

Share this post


Link to post
Share on other sites

Very Cool. Thank you!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0