problems changing the "manager" property for a user in active directory



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


.



Relevant Pages

  • Re: Need assistance badly!
    ... I have tried cobbling together a script that does this, ... I would use ADO in a VBScript program to retrieve all users with the ... Dim objRootDSE, strDNSDomain, strQuery, adoRecordset, strName, strCN ... adoConnection.Open "Active Directory Provider" ...
    (microsoft.public.scripting.vbscript)
  • Re: Another Newbie
    ... I need a script that will give me a list of all users who's ... ' Use ADO to search Active Directory. ... Set adoConnection = CreateObject ... ' Filter on user objects that have password never expires flag set. ...
    (microsoft.public.windows.server.scripting)
  • Re: Operations Masters
    ... Run diagnostics against your Active Directory domain. ... Run dcdiag, netdiag and repadmin in verbose mode. ... If you download a gui script I wrote it should be simple to set and run ...
    (microsoft.public.windows.server.active_directory)
  • Problems after new install
    ... which shows that Win 2000 is not responding. ... If I choose Shutdown from task manager, ... "Internet Explorer Script Error. ... that are initiated at startup (using StartUp Cop), ...
    (microsoft.public.win2000.general)
  • New installation problems.
    ... which shows that Win 2000 is not responding. ... If I choose Shutdown from task manager, ... "Internet Explorer Script Error. ... that are initiated at startup (using StartUp Cop), ...
    (microsoft.public.win2000.setup)