| 
| 
| 
| #195015 - 2009-07-24 03:56 PM  Join domain VBS Conversion |  
| jadewith   Fresh Scripter
 
 Registered:  2003-06-13
 Posts: 45
 Loc:  Good ole U S of A
 | 
Hi everyone,
 I am in the process of migrating from a poorly put together Novell 5.1 Domain to an 2003 AD domain.  I'm rying to convert the following VB script to KiXtart and am having a little trouble.  I have run Sanity against My conversion and do not receive anything but the time.  When I run the script in KiXtart I receive the error
 
 
  ERROR: expected ')'!Line: 39
 
 My script:
 
  DIM $JOIN_DOMAIN
DIM $ACCT_CREATE
DIM $ACCT_DELETE
DIM $WIN9X_UPGRADE
DIM $DOMAIN_JOIN_IF_JOINED
DIM $JOIN_UNSECURE
DIM $MACHINE_PASSWORD_PASSED
DIM $DEFERRED_SPN_SET
DIM $INSTALL_INVOCATION
DIM $strDomain
DIM $strPassword
DIM $strUser
DIM $objNetwork
DIM $strComputer
DIM $objComputer
DIM $rc
$JOIN_DOMAIN = 1
$ACCT_CREATE = 2
$ACCT_DELETE = 4
$WIN9X_UPGRADE = 16
$DOMAIN_JOIN_IF_JOINED = 32
$JOIN_UNSECURE = 64
$MACHINE_PASSWORD_PASSED = 128
$DEFERRED_SPN_SET = 256
$INSTALL_INVOCATION = 262144
$strDomain = "Bandcamp.local"
$strPassword = "Flute"
$strUser = "Say my Name!"
$objNetwork = CreateObject("WScript.Network")
$strComputer = $objNetwork.ComputerName
$objComputer = GetObject("winmgmts:{impersonationLevel=Impersonate}!//$strComputer")
$rc=$objComputer.JoinDomainOrWorkGroup($strDomain,$strPassword, $strUser, '', $JOIN_DOMAIN + $ACCT_CREATE) 
 Original VBS:
 
 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 = "Cnail.com"
strPassword = "hicane"
strUser = "jdewith"
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) 
 You help, as always, is appreciated,
 Jason
 |  
| Top |  |  |  |  
| 
| 
| #195019 - 2009-07-24 04:25 PM  Re: Join domain VBS Conversion
[Re:  Allen] |  
| jadewith   Fresh Scripter
 
 Registered:  2003-06-13
 Posts: 45
 Loc:  Good ole U S of A
 | 
Thanks Allen,
 I'll take a look
 
 |  
| Top |  |  |  |  
| 
| 
| #195022 - 2009-07-24 05:27 PM  Re: Join domain VBS Conversion
[Re:  jadewith] |  
| jadewith   Fresh Scripter
 
 Registered:  2003-06-13
 Posts: 45
 Loc:  Good ole U S of A
 |  |  
| Top |  |  |  |  
| 
| 
| #195037 - 2009-07-25 02:51 PM  Re: Join domain VBS Conversion
[Re:  Allen] |  
| Radimus   Moderator
 
       
   Registered:  2000-01-06
 Posts: 5187
 Loc:  Tampa, FL
 | 
I have a joindomain tool as well based somewhat from the above code.
 I have recently been granted a "service acct" for joining computers and our naming convention has been changed to serno = @wksta, I can "automate" it...
 
 I have an IP subnet detection feature to select the default OU and am also making a GPO to run the script on all PCs in the default "Computers" container... for the lazy IT staff that don't put the PCs into the correct OUs.
 |  
| Top |  |  |  |  
| 
| 
| #195073 - 2009-07-28 08:21 AM  Re: Join domain VBS Conversion
[Re:  NTDOC] |  
| Arend_   MM club member
 
       
   Registered:  2005-01-17
 Posts: 1896
 Loc:  Hilversum, The Netherlands
 | 
I remember writing one for you doc, just to get you off that NETDOM tool ;-) Was something with a KixForms GUI you've written for NETDOM and I rewrote it with builtin code. Can't find the post though...
 [edit]
 Found it
 [/edit]
 |  
| Top |  |  |  |  
| 
| 
| #195114 - 2009-07-29 09:28 PM  Re: Join domain VBS Conversion
[Re:  NTDOC] |  
| Radimus   Moderator
 
       
   Registered:  2000-01-06
 Posts: 5187
 Loc:  Tampa, FL
 | 
I just wrote a new version of my old code and it works fine for about 90% of my machines... but some of them cough up error 1219
 
 
	$newname = 'NewName'
	$objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" + $strComputer + "\root\cimv2")
	$colComputers = $objWMIService.ExecQuery("Select * from Win32_ComputerSystem")
	For Each $objComputer in $colComputers
		$err = $objComputer.Rename($NewName, $password, $user)
		If $err
			 $nul = sendmessage(@wksta, "Failed Renaming "+@wksta+" to "+$NewName + @crlf + $err)
		else
			$nul = sendmessage(@wksta, "Updates to this PC require the computer to reboot. Please reboot at your earliest convenience.")
		endif
	Next
 |  
| Top |  |  |  |  
 Moderator:  Shawn, ShaneEP, Ruud van Velsen, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Mart
 
 | 
| 
 
| 0 registered
and 739 anonymous users online. 
 | 
 |  |