Login | |
|
 |
Re: ADSI Script to check Computer name and Domain - 2/25/2005 2:00:24 AM
|
|
 |
|
| |
mbouchard
Posts: 1804
Score: 12
Joined: 5/15/2003
From: USA
Status: online
|
I too use PE and was wondering if you could post the code that you use to check for the PC in AD? Thanks,
|
|
| |
|
|
|
 |
Re: ADSI Script to check Computer name and Domain - 2/25/2005 5:56:55 AM
|
|
 |
|
| |
mbouchard
Posts: 1804
Score: 12
Joined: 5/15/2003
From: USA
Status: online
|
Thanks, will need to try that out.
|
|
| |
|
|
|
 |
Re: ADSI Script to check Computer name and Domain - 3/8/2005 11:31:16 AM
|
|
 |
|
| |
robszar
Posts: 173
Score: 0
Joined: 2/27/2005
From:
Status: offline
|
I am running into the same situation as above, using WinPE I cannot create a computer account in AD, can I enter a userid & password while commecting to AD at end of this string: GetObject("LDAP://cn=Computers,dc=NA,dc=fabrikam,dc=com") also post-ghost the machine boots up as a member of a workgroup, a script runs that finds the computer account in AD, renames the computer and joins to the domain. I am getting Error: Table does not exist. when searching AD for the computer account. when joining the domain I can use runas /netonly / user: to run the script and that works but then you have to enter the password manually, which sucks but works. runas doesn't seem to work in WinPE.
|
|
| |
|
|
|
 |
Re: ADSI Script to check Computer name and Domain - 3/8/2005 2:09:44 PM
|
|
 |
|
| |
robszar
Posts: 173
Score: 0
Joined: 2/27/2005
From:
Status: offline
|
Windows Preinstallation Environment, it's an OS on CD used to load ghost images, so the machine bootWindows Preinstallation environment, it's an OS on CD used to load ghost images, so the machine boots up and generates a temp computer name and is not on the domain. The issue with the script is you are not logged in with domain credentials so the AD query doesnÒt work without a username and password with domain authentication. The error occurs when you try and execute the query. Is there a way to embed a user name and password? Your script is solid when ran from a computer that is a part of the domain. Function isComputerAccountExists(host) Dim conn, cmd , rs Set conn = CreateObject("ADODB.Connection") Set cmd = CreateObject("ADODB.Command") conn.provider = "adsdsoobject" conn.open "active directory provider" cmd.activeconnection = conn cmd.commandtext = "<LDAP://" & GetObject("LDAP://rootdse").Get("defaultnamingcontext") & ">;(&(objectcategory=computer)(objectclass=computer)(cn=" & host & "));cn;subtree" Set rs = cmd.Execute<---------------This is where it bombs If rs.recordcount = 0 Then isComputerAccountExists = False Else isComputerAccountExists = True End If End Function
|
|
| |
|
|
|
 |
Re: ADSI Script to check Computer name and Domain - 3/9/2005 1:26:57 AM
|
|
 |
|
| |
robszar
Posts: 173
Score: 0
Joined: 2/27/2005
From:
Status: offline
|
That is perferct for the Post-Ghost process, I was missing the DC, once I put that in it worked. 1 more question, when I boot up with the Windows PE and try and add the Computer account I can't get connected to AD, this is the string I'm using to connect: Set objContainer = GetObject(provider & computerOU) can I use ADO to add the computer account to AD or can I use a username and password doing it this way? THanks!
|
|
| |
|
|
|
 |
Re: ADSI Script to check Computer name and Domain - 3/9/2005 8:36:26 AM
|
|
 |
|
| |
robszar
Posts: 173
Score: 0
Joined: 2/27/2005
From:
Status: offline
|
Thanks again Token, Works great
|
|
| |
|
|
|
 |
Re: ADSI Script to check Computer name and Domain - 3/10/2005 5:11:08 AM
|
|
 |
|
| |
mbouchard
Posts: 1804
Score: 12
Joined: 5/15/2003
From: USA
Status: online
|
quote: Originally posted by token What is WinPE ?
Here is some more info on WinPE. http://www.microsoft.com/licensing/programs/sa/support/winpe.mspx It is basically a stripped down version of XP minus the GUI, that as robszar said, boots from a CD.
|
|
| |
|
|
|
|
|