Jump to content

bowers01

Members
  • Posts

    3
  • Joined

  • Last visited

Everything posted by bowers01

  1. Hi, I still can not get it working. Attached below is the code i was using, was there anything i missed? Regards, Nick If WScript.Arguments.length =0 Then Set objShell = CreateObject("Shell.Application") 'Pass a bogus argument with leading blank space, say [ uac] objShell.ShellExecute "wscript.exe", Chr(34) & _ WScript.ScriptFullName & Chr(34) & " uac", "", "runas", 1 Else 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 Const strOU = "ou=computers, dc=ogps, dc=wan" strDomain = "ogps" strPassword = "password" strUser = "administrator" 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, _ strOU, _ JOIN_DOMAIN + ACCT_CREATE ,True) strComputer = "." Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate,(Shutdown)}!\\" & _ strComputer & "\root\cimv2") Set colOperatingSystems = objWMIService.ExecQuery _ ("Select * from Win32_OperatingSystem") For Each objOperatingSystem in colOperatingSystems objOperatingSystem.Reboot() Next end if
  2. Hi, Thanks for that, the rename script works fine. I cant get the join domain script to work though, on windows 7 and server 2008R2 Any ideas? Cheers
  3. What needs to be changed to get it to work on windows 7? I did test it and it works fine on xp. Cheers, Nick
×
×
  • Create New...