problems changing the "manager" property for a user in active directory
- From: "Greg Brown" <greg@xxxxxxxxxxxx>
- Date: Tue, 10 May 2005 11:30:26 -0700
Greetings,
I am trying to write a vbscript to change the "manager" property of users
within active directory. I am running Windows 2003 active directory and the
script is running on my XP Pro (sp2) workstation.
Here is a simple example of what I have so far. The script errors out on
the oUser.Put line. I have tried putting in the sAMAccountName and
displayName for the manager but the error is the same. The error is
0x80050F if this helps.
I have tried googleing for this but it is difficult to get results on the
word "manager" that only apply to the user property as seen on the
Organization tab in the Active Directory Users and Computers tool.
Any suggestions would be greatly appreciated.
Thanks,
Greg
gbrown1 _at_ gmail _dot_ com
*********** begin script **************
Dim SourceFile, InputFile
Dim strUserName
Dim oShell, oFS, oNet, oDomain, oUser, strUserHome
Set oShell = CreateObject("Wscript.Shell")
Set oFS = CreateObject("Scripting.FileSystemObject")
Set oNet = CreateObject("Wscript.Network")
Set oDomain = GetObject("WinNT://My_Domain" )
Const ForReading = 1
SourceFile = "C:\temp\users.txt"
If oFS.FileExists(SourceFile) Then
Set InputFile = oFS.OpenTextFile(SourceFile,ForReading)
While Not InputFile.AtEndOfStream
strUserName = InputFile.ReadLine
Set oUser = GetObject("WinNT://My_Domain/" & strUserName)
oUser.Put "Manager", "jsmith"
oUser.SetInfo
Wend
InputFile.Close
End If
.
- Follow-Ups:
- Re: problems changing the "manager" property for a user in active directory
- From: Al Dunbar [MS-MVP]
- Re: problems changing the "manager" property for a user in active directory
- Prev by Date: Re: Update TNSNames.ora via Script
- Next by Date: Create Shortcut...check to see first?
- Previous by thread: Update TNSNames.ora via Script
- Next by thread: Re: problems changing the "manager" property for a user in active directory
- Index(es):
Relevant Pages
|