Jump to content

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


E1M1
 Share

Recommended Posts

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.

Link to comment
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

Link to comment
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

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...