joing a workgroup

  • Thread starter Thread starter kbodily
  • Start date Start date
here is a VBScript way...I imagine you can convert it to vb.net. It gathers
the names of all the computers in a workgroup, allows you to edit the list
then loops through and joins them to the new workgroup. Each computer must
have the same admin account and password for this to work.

dim objShell
const Minimize_Window = 2
const ForReading = 1
Set objShell = WScript.CreateObject("WScript.Shell")
strFile = "ComputerList.txt"
objShell.Run "cmd /c net view /DOMAIN:WORKGROUP >" & strFile, 0 , TRUE
Wscript.echo "WARNING" & vbCrLF & "Take this time to edit the
computerlist.txt" & vbCrLF & "Press OK, once complete"
Dim objValue, OldPCName, NewPCName, oWshShell, test, command
Set ObjFSO = CreateObject("scripting.FileSystemObject")
Set objComputerlist = objFSO.OpenTextFile("ComputerList.txt", ForReading)
Do until objComputerList.AtEndofStream
strComputer = RTrim(Left(objComputerlist.readline, 17))
'wscript.echo "net use \\" & strComputer & "\ipc$ /user:username password"
objShell.Run "net use \\" & strComputer & "\ipc$ /user:username password",
1, TRUE
'wscript.echo "netdom.exe MEMBER \\" & strComputer & " /joinworkgroup
newworkgroup"
objShell.Run "netdom.exe MEMBER \\" & strComputer & " /joinworkgroup
newworkgroup", 1, TRUE
Loop


Eric
 
Thanks Eric,
You seem to be using netdom to join the workgroup. Unfortunatley, I
cannot guarantee it is installed on the machine the code will run on.
Any other ways?
kevin
 
I just have it in the folder I run the script from. I think if you use .NET
you will still need to use those same libraries...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top