I'm running this script on Windows 2008 domain from Exchange 2003
server (all DC's are 2008 core - no GUI). I copied a sript that worked
in other 2003 domain, but now it does not. Is there a difference with
2008 domain? I get the below error message.
---------------------------
Windows Script Host
---------------------------
Script: C:\Documents and Settings\eurodata\Desktop\Scripts\Write
Domain Admins to a file.vbs
Line: 12
Char: 5
Error: 0x80005000
Code: 80005000
Source: (null)
---------------------------
OK
---------------------------
Line 12 is:
Set objUser = GetObject("LDAP://" & strUser)
And the whole script:
------------------------------------------------------------------------------
Dim arrNames()
intSize = 0
Set objFSO = CreateObject("Scripting.FileSystemObject")
strfilepath = inputbox( "Please Enter Path and File Name. The output
is in xls Format.", "Input" )
Set objTextFile = objFSO.CreateTextFile(strfilepath & ".xls", True)
Set objGroup = GetObject("LDAP://cn=Domain
Admins,CN=Users,dc=bedford,dc=local")
For Each strUser in objGroup.Member
Set objUser = GetObject("LDAP://" & strUser)
ReDim Preserve arrNames(intSize)
arrNames(intSize) = objUser.CN
intSize = intSize + 1
Next
For i = (UBound(arrNames) - 1) to 0 Step -1
For j= 0 to i
If UCase(arrNames(j)) > UCase(arrNames(j+1)) Then
strHolder = arrNames(j+1)
arrNames(j+1) = arrNames(j)
arrNames(j) = strHolder
End If
Next
Next
For Each strName in arrNames
objTextFile.WriteLine strName
Next
WScript.Echo "This Script is now complete"
-----------------------------------------------------------------------------------------------------
Thank you for your help.
Thanks.
The basic code works fine except in one rare situation. If any member of the
group has a forward slash "/" anywhere in the name you get the error you
describe. ADSI doesn't handle the character correctly. In VBScript the fix
is to escape it with the backslash escape character. For example:
=======
For Each strMemberDN in objGroup.Member
strMemberDN = Replace(strMemberDN, "/", "\/")
Set objMember = GetObject("LDAP://" & strMemberDN)
Wscript.Echo objMember.cn
Next
========
For discussion of characters to escape see this link:
http://www.rlmueller.net/CharactersEscaped.htm
There are several characters that must be escaped if you hard code a
Distinguished Name, but ADSI escapes them all for you (when you use ADSI
methods or attributes) except for the forward slash.
--
Richard Mueller
MVP Directory Services
Hilltop Lab - http://www.rlmueller.net
--
Thanks
I am trying to delete a computer from a domain but logged on as a local administrator. I was looking at using the following script:
strDelPC = domain_controller/CN=computer_name,CN=Computers,DC=domain,DC=com
set delComputer = GetObject("LDAP://" & strDelPC )
delComputer.DeleteObject (0)
I keep getting Error: 0x80005000, Code: 80005000
Source: (null)
I have already got access using the following further up the script:
' Determine DNS domain name
Set objNS = GetObject("LDAP:")
Set objRootDSE = objNS.OpenDSObject("LDAP://" & strServer & "/RootDSE", _
strUser, strPassword, _
ADS_SERVER_BIND or ADS_SECURE_AUTHENTICATION)
Can anyone help?
> On Friday, October 17, 2008 8:49 AM Richard Mueller [MVP] wrote:
> Ruok wrote:
>
>
> The basic code works fine except in one rare situation. If any member of the
> group has a forward slash "/" anywhere in the name you get the error you
> describe. ADSI doesn't handle the character correctly. In VBScript the fix
> is to escape it with the backslash escape character. For example:
> =======
> For Each strMemberDN in objGroup.Member
> strMemberDN = Replace(strMemberDN, "/", "\/")
> Set objMember = GetObject("LDAP://" & strMemberDN)
> Wscript.Echo objMember.cn
> Next
> ========
> For discussion of characters to escape see this link:
>
> http://www.rlmueller.net/CharactersEscaped.htm
>
> There are several characters that must be escaped if you hard code a
> Distinguished Name, but ADSI escapes them all for you (when you use ADSI
> methods or attributes) except for the forward slash.
>
> --
> Richard Mueller
> MVP Directory Services
> Hilltop Lab - http://www.rlmueller.net
> --
>> On Saturday, October 18, 2008 1:05 PM Ruok wrote:
>> Hi,
>> Thank you for your help.
"Matthew Evans" <it.su...@advancedsupplychain.com> wrote in message
news:201141595...@terrranews.com...
> Hi,
>
> I am trying to delete a computer from a domain but logged on as a local
> administrator. I was looking at using the following script:
>
> strDelPC =
> domain_controller/CN=computer_name,CN=Computers,DC=domain,DC=com
Try quoting your literal string like this:
strDelPC =
"domain_controller/CN=computer_name,CN=Computers,DC=domain,DC=com"
If that isn't the problem, try posting a copy of the actual script used.
Also, note that you are replying to a post that is about two and a half
years old.
/Al