Any hope there?
Thansk,
Gordon
Hi
===========================================================
WMI, join domain or workgroup, WinXP *only*
===========================================================
JoinDomainOrWorkgroup Method in Class Win32_ComputerSystem
http://msdn.microsoft.com/library/en-us/wmisdk/wmi/joindomainorworkgroup_method_in_class_win32_computersystem.asp
JoinDomainOrWorkgroup can only be used for WinXP!
Here is a script from the TechNet Scripting Center that uses the
JoinDomainOrWorkgroup method:
Join Computer to a Domain
http://www.microsoft.com/technet/scriptcenter/compmgmt/scrcm31.asp
===========================================================
Command line, join domain or workgroup, WinNT, Win2k and WinXP
===========================================================
Some words on running command line utils remotely:
PsExec (in the free PsTools suite at http://www.sysinternals.com) can be used
for this, e.g like this:
psexec.exe \\some_computer -c c:\util\some.exe -l -t 0
The file "behind" -c must exist on the local computer running PsExec.exe. PsExec
will copy the specified program to the remote system for execution and run it
with any additional switches.
If you do not have a domain user/group in the local admin group, username and
password can be supplied:
psexec.exe \\some_computer -u user -p pwd -c C:\q323759.exe /q:a /r:n
For remote reboot, try PsShutdown in the free PsTools suite at
http://www.sysinternals.com
===========================================================
Command line, join workgroup
===========================================================
You need the *old* NT 4.0 version of netdom.exe to add computers to a
_workgroup_ for Win2000 and WinXP.
Someone at Microsoft in their devine knowledge found out that nobody wants to
add a computer to a workgroup anymore (at least not programmatically), so they
have removed this option in the Win2000/XP version. They got domains and AD on
their brains, that is for sure ;-).
Luckily the NT version still works on Win2000 and WinXP, at least for the
workgroup part of it :-)
Netdom.exe version 1.8 dated 30. juni 1999 can be downloaded from the following
Microsoft FTP site:
ftp://ftp.microsoft.com/reskit/nt4/x86/
self extracting zip file file: netdom_x86.exe
We have been using version 1.7 for this on Win2000, but I have tested v1.8 on
Win2000 and WinXP and it worked.
NB! Do not use this version (1.8) for joining domain on Win2000/XP!
Here is a "screen shot":
<COMMAND PROMPT>
C:\>NETDOM18 MEMBER \\QMBTJL441 /JOINWORKGROUP TESTWG
NetDom 1.8 @1997-98. Written by Christophe Robert - Microsoft.
Querying domain information on computer \\QMBTJL441 ...
Computer \\QMBTJL441 is currently in workgroup SOME.
Changing LSA primary domain information on computer \\QMBTJL441 ...
Updating trusted domain ...
Changing startup of service NETLOGON on \\QMBTJL441.
Stopping service NETLOGON on \\QMBTJL441 ... stopped.
The computer \\QMBTJL441 joined the workgroup TESTWG successfully.
Logoff/Logon \\QMBTJL441 to take modifications into effect.
</COMMAND PROMPT>
===========================================================
Command line, join domain
===========================================================
Netdom.exe
How To Join a Domain From the Command Line
http://support.microsoft.com/default.aspx?scid=kb;en-us;Q150493
How to Use Netdom 2.0 to Create a Windows Computer Account on a Selected Domain
Controller
http://support.microsoft.com/support/kb/articles/Q266/6/51.ASP
Automating the Creation of Computer Accounts
http://support.microsoft.com/default.aspx?scid=kb;en-us;Q222525
Latest version of netdom.exe can be downloaded from here:
Windows 2000 SP3 Support Tools
http://www.microsoft.com/windows2000/downloads/servicepacks/sp3/supporttools.asp
There came one updated version with SP2 as well, but I would be very surprised
if the SP3 netdom version do not work on pre SP3 computers.
Anyway, the one that came with SP2 can be found here:
Windows 2000 SP2 Support Tools
http://www.microsoft.com/windows2000/downloads/servicepacks/sp2/supporttools.asp
You can also test on the result of the join by testing on the return code of
netdom.exe:
From: Developer_for (add...@hotmail.com)
Subject: Joining Domain and Verifying it ....
Newsgroups: microsoft.public.scripting.vbscript
Date: 2002-04-21 23:58:57 PST
http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&th=f5c28b1129d85de
--
torgeir
> "Torgeir Bakken" <Torgeir.B...@hydro.com> wrote in
> message Torgeir,Thanks for the roadmap. I found the code, and tweaked it as
> below, and I get an error that I am already a member of a domain. In this case
> I am trying to join a workgroup (error # 2691). Any thoughts? ReturnValue =
> objComputer.JoinDomainOrWorkGroup(strWorkgroup,, _
> strPassword, _
> strDomain & "\" & strUser, _
> NULL, _
> ACCT_DELETE)
Hi
You have six parameters to the JoinDomainOrWorkgroup in the code above, that is
one too much.
I guess
strWorkgroup,, _
should really be
strWorkgroup, _
Anyway, even if I fixed this, I couldn't get JoinDomainOrWorkgroup to switch me
from a domain to a workgroup, I also tried differen values for ACCT_DELETE. I
had to use UnJoinDomainOrWorkGroup to make things work.
This code switched me from a domain member to workgroup:
Set objNetwork = CreateObject("WScript.Network")
strComputer = objNetwork.ComputerName
Set objComputer = GetObject("winmgmts:{impersonationLevel=Impersonate}!\\" & _
strComputer & "\root\cimv2:Win32_ComputerSystem.Name='" & _
strComputer & "'")
ReturnValue = objComputer.UnJoinDomainOrWorkGroup(,,0)
--
torgeir