Re: From Workgroup to Domain



Hi Gib

Ok thank you for the help - nice to see the script run :)

I can´t get it to run on win2k, I don´t really know netdom.exe or how
it should help the win2k clients. - but its all good :)

Have a good one.

Regardz
Max

Gibraltar skrev:
Max,

The same should work fine on Win2K. Pls try out. If it doesn't work then try
to do a search on Microsoft site for netdom.exe and see its usage and try
out. I thin tht should hlp you.
Cheers,
Gib

"max@xxxxxxx" wrote:

Hi Gib

It works on XP, is there anyway i can get this to run on win2k clients
aswell ? - and oh yes after a boot on a xp client the test was good,
and it work´d great. thank you.

/Max

Gibraltar skrev:
Hello Max,

Pls use the following code.

Const JOIN_DOMAIN = 1
Const ACCT_CREATE = 2
Const ACCT_DELETE = 4
Const WIN9X_UPGRADE = 16
Const DOMAIN_JOIN_IF_JOINED = 32
Const JOIN_UNSECURE = 64
Const MACHINE_PASSWORD_PASSED = 128
Const DEFERRED_SPN_SET = 256
Const INSTALL_INVOCATION = 262144

strDomain = "FABRIKAM"
strPassword = "ls4k5ywA"
strUser = "shenalan"

Set objNetwork = CreateObject("WScript.Network")
strComputer = objNetwork.ComputerName

Set objComputer = GetObject("winmgmts:{impersonationLevel=Impersonate}!\\" & _
strComputer & "\root\cimv2:Win32_ComputerSystem.Name='" & _
strComputer & "'")

ReturnValue = objComputer.JoinDomainOrWorkGroup(strDomain, _
strPassword, strDomain & "\" & strUser, NULL, _
JOIN_DOMAIN + ACCT_CREATE)


Change the strdomain, user and password accordingly. The user should hv the
domain join priviliges.

Cheers,
Gib





"max@xxxxxxx" wrote:

Here´s the whole code as it is at the moment.

Set objWMIService = GetObject("winmgmts:
{impersonationlevel=impersonate}!\\<computername>\root\cimv2")
Const JOIN_DOMAIN = 1
set objComputer = objWMIService.Get("Win32_ComputerSystem.Name='" &
strCName & " ' ")
objComputer.JoinDomainOrWorkGroup strDomainName, strPassword, strNetDom
& "\" & strUser, NULL, JOIN_DOMAIN


m...@xxxxxxx skrev:
Hi Gib

it says: Line 1 letter 1 unspecefied error

:(

(I do a cscript "c:\yourscripthere.vbs" i command prompt)

/Max

Gibraltar skrev:
Please add this line to the code as a first line...
Set objWMIService = GetObject("winmgmts: {impersonationlevel=impersonate}!\\
<computername>\root\cimv2")
I am sorry I missed this out. Let me know if this doesn't work.

"max@xxxxxxx" wrote:

when i run the script I get an objet "objwmiservice" i necessary. when
i just raw copy paste your script :/ - what am i missing here to make
it work?


max@xxxxxxx skrev:
Hehe, i got some issuses with the script :( i just do a script
"test.vbs" at a prompt, and it gives me errors :( - But yearh just file
copying netdom.exe on to a win2k client doesen´t work :)

Gibraltar skrev:
Hi Max,

You can use these WMI lines in a VB Script

Const JOIN_DOMAIN = 1
set objComputer = objWMIService.Get("Win32_ComputerSystem.Name='" & strCName
& "'")
objComputer.JoinDomainOrWorkGroup strDomainName, strPassword, strNetDom &
"\" & strUser, NULL, JOIN_DOMAIN

where strCname is the Computer Name on which this script is running
strDomainName is the domain to which it has to join
strNetDom is the netbios name of the domain
strUser is the User that has priviliges to join a machine to the domain
strPassword is the password of the user.

Alternately as Jorge said you can use netdom utility but again you need copy
it to all the machines along with a supporting script.

Cheers,
Gib




"Jorge Silva" wrote:

Hi
do you like netdom?
http://technet2.microsoft.com/WindowsServer/en/library/539c5381-db4f-445f-aac0-2df5448181c11033.mspx?mfr=true

--
I hope that the information above helps you
Good Luck

Jorge Silva
MCSA
Systems Administrator

<max@xxxxxxx> wrote in message
news:1162821668.849920.290470@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hi

Any chance you would have a demo or simply script done allready that
you can share? - would be cool, cos we could then try start to make the
first couple test on how that solution could work out, - and thank you
for the suggestion so far :)


Gibraltar skrev:
Hi Max,

Create a vbscript that joins a machine to domain. Using psexec tools,
copy
and execute them on all the machines to join them to the domain.

Hope this helps,
Gib

"max@xxxxxxx" wrote:

Hello,

I need a way, How i can centraly or via. a batch job change a clients
machine from a standard local workgroup, to being a member of my
domain.

Regardz:
Googler












.



Relevant Pages

  • Re: From Workgroup to Domain
    ... Gibraltar skrev: ... Const JOIN_DOMAIN = 1 ... You can use these WMI lines in a VB Script ... objComputer.JoinDomainOrWorkGroup strDomainName, strPassword, strNetDom & ...
    (microsoft.public.windows.server.active_directory)
  • Re: From Workgroup to Domain
    ... Gibraltar skrev: ... Const JOIN_DOMAIN = 1 ... You can use these WMI lines in a VB Script ... objComputer.JoinDomainOrWorkGroup strDomainName, strPassword, strNetDom & ...
    (microsoft.public.windows.server.active_directory)
  • Re: From Workgroup to Domain
    ... is there anyway i can get this to run on win2k clients ... Gibraltar skrev: ... Const JOIN_DOMAIN = 1 ... You can use these WMI lines in a VB Script ...
    (microsoft.public.windows.server.active_directory)
  • Re: From Workgroup to Domain
    ... Const JOIN_DOMAIN = 1 ... Gibraltar skrev: ... You can use these WMI lines in a VB Script ... objComputer.JoinDomainOrWorkGroup strDomainName, strPassword, strNetDom & ...
    (microsoft.public.windows.server.active_directory)
  • Re: Setting environment variables in IIS 6.0 [PERL @INC MANIPULATION]
    ... included the sample drsaticly reduced VBS script below - the script will add ... > Only option I can think of is to write to the IIS Admin APIs using script. ... Const L_ChkCmdLibReg_ErrorMessage = "Please register the ...
    (microsoft.public.inetserver.iis)