Page 1 of 1 1
Topic Options
#195015 - 2009-07-24 03:56 PM Join domain VBS Conversion
jadewith Offline
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

 Quote:
ERROR: expected ')'!
Line: 39



My script:
 Code:
 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:
 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 = "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
#195018 - 2009-07-24 04:23 PM Re: Join domain VBS Conversion [Re: jadewith]
Allen Administrator Online   shocked
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4557
Loc: USA
I've looked over your script... and I've run out of time. I did a board search on JoinDomainOrWorkGroup and it pulled up a couple of threads which it appeared to be working. I did see Null was defined as "NULL" in one thread, and tried it but got the same error as you. Maybe they will give you some direction.
Top
#195019 - 2009-07-24 04:25 PM Re: Join domain VBS Conversion [Re: Allen]
jadewith Offline
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 Offline
Fresh Scripter

Registered: 2003-06-13
Posts: 45
Loc: Good ole U S of A
Got it here

http://www.kixtart.org/forums/ubbthreads.php?ubb=showthreaded&Number=176628

Thanks again Allen

Top
#195023 - 2009-07-24 11:52 PM Re: Join domain VBS Conversion [Re: jadewith]
Allen Administrator Online   shocked
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4557
Loc: USA
I see now in your VBS to Kix conversion, this line is different.

 Quote:
$objComputer = GetObject("winmgmts:{impersonationLevel=Impersonate}!//" + $strComputer)


This code is dang near exactly the same as the linked one... Apronk must have gotten his from the same source. \:\)

Top
#195037 - 2009-07-25 02:51 PM Re: Join domain VBS Conversion [Re: Allen]
Radimus Moderator Offline
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.
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#195068 - 2009-07-27 11:10 PM Re: Join domain VBS Conversion [Re: Radimus]
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11625
Loc: CA
What a step back in time. I never did write an update for the KiXforms JoinAD script as I ended up never really needing to do it much after that.
Top
#195073 - 2009-07-28 08:21 AM Re: Join domain VBS Conversion [Re: NTDOC]
Arend_ Moderator Offline
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
#195108 - 2009-07-29 08:32 PM Re: Join domain VBS Conversion [Re: Arend_]
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11625
Loc: CA
Yeah, thanks but that's what I mean. I never did get around to doing it because after that main big push I didn't need to use it much anymore.

As is often the case, got busy with other things and never did get back to it.

Top
#195114 - 2009-07-29 09:28 PM Re: Join domain VBS Conversion [Re: NTDOC]
Radimus Moderator Offline
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

 Code:

	$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
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
Page 1 of 1 1


Moderator:  Shawn, ShaneEP, Ruud van Velsen, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 581 anonymous users online.
Newest Members
Audio, Hoschi, Comet, rrosell, PatrickPinto
17880 Registered Users

Generated in 0.058 seconds in which 0.025 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org