How could I port a perl script back to vb?
|
John
Hicks | KEMET
Electronics Corporation | Network
Engineer Phone: 864-228-4473 | E-mail: [EMAIL PROTECTED] | AOL IM: ipaq1978 [ Mailing: 2835 KEMET Way Simpsonville, SC 29681 USA ] |
| "Carey, Greg"
<[EMAIL PROTECTED]>
Sent by: [EMAIL PROTECTED] 11/13/2002 03:04 PM
|
|
John,
By default, Users is just a container in an Active Directory domain as opposed to an OU (unless of course you removed it and recreated it as an ou). You target container would be:
Set objOU = GetObject(LDAP://cn=users,dc=NTDEV3,dc=KEMET,dc=com)
-----Original Message-----
From: Edgington, Jeff [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, November 13, 2002 2:58 PM
To: [EMAIL PROTECTED]
Subject: RE: [ActiveDir] AD Move Users script
This perl script does what you need (via win32::ole)... not sure if you interested in perl, but you can port it back to vbs... someone on another script gave this to me (can't remember his name though).
use Win32::OLE;
#
# I'm going to tokenize (makes things shorter, easier to read) #
my $UserObject = "LDAP://CN=Test edgington,CN=Users,DC=umr,DC=edu";
my $RelativeName = "CN=Test edgington";
my $TargetContainer = "LDAP://OU=CIS,OU=Accounts,DC=umr,DC=edu";
# Bind to the TARGET Container (OU)
my $Container = Win32::OLE->GetObject($TargetContainer);
# "pull" the object from where it is to where I'm at...
$Container->MoveHere($UserObject,$RelativeName);
-----Original Message-----
From: John Hicks/MIS/HQ/KEMET/US [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, November 13, 2002 1:49 PM
To: [EMAIL PROTECTED]
Subject: RE: [ActiveDir] AD Move Users script
I gave that a shot, but still received the same " There is no such object on the server error". I have been hunting around more on how to do this with not much luck, but I know that it can be done.
Thanks
|
John
Hicks | KEMET
Electronics Corporation | Network
Engineer Phone: 864-228-4473 | E-mail: [EMAIL PROTECTED] | AOL IM: ipaq1978 [ Mailing: 2835 KEMET Way Simpsonville, SC 29681 USA ] |
| "Jones, Rick J.(Desktop
Engineering)" <[EMAIL PROTECTED]> Sent by: [EMAIL PROTECTED] 11/13/2002 02:33 PM
|
|
You can not use VBNullString in VBScript.
Try this;
Set objOU = GetObject("LDAP://ou=users,dc=NTDEV3,dc=KEMET,dc=com")
objOU.MoveHere "LDAP://cn=Gberar1,OU=ACCT,dc=NTDEV3,dc=KEMET,dc=com",”cn=Gberar1”
Rick J. Jones
-(NDE) National Desktop Engineering
-<http://nits.attws.com/dte>
-Headquarters RTC4 LAB 2461D
-Exchange IM ID:[EMAIL PROTECTED]
-Phone 425-580-8061
-----Original Message-----
From: John Hicks/MIS/HQ/KEMET/US [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, November 13, 2002 8:22 AM
To: [EMAIL PROTECTED]
Subject: [ActiveDir] AD Move Users script
I am working on a script to move users from the default users container to OU's that we specify. The goal is to be able to run an nlist from Novell to a text file and then have the script move the users in each text file to their designated OU's. I have looked around at a couple different places and have not found anything like this. Below is the script I was trying to use from Microsoft's scripting center, but I receive and an error when I run it that states object does not exist on the specified server. I checked in ADUC and the ID is there, so I am not sure why it cannot find it.
Set objOU = GetObject("LDAP://ou=users,dc=NTDEV3,dc=KEMET,dc=com")
objOU.MoveHere _
"LDAP://cn=Gberar1,OU=ACCT,dc=NTDEV3,dc=KEMET,dc=com", vbNullString
I have tried adding cn=Gberar1 to the beginning of the first statement and this does not help. I am sure it is something simple that I am missing but I cannot figure it out. Any help would be greatly appreciated.
Thanks
|
John
Hicks | KEMET
Electronics Corporation | Network
Engineer Phone: 864-228-4473 | E-mail: [EMAIL PROTECTED] | AOL IM: ipaq1978 [ Mailing: 2835 KEMET Way Simpsonville, SC 29681 USA ] |
