Do not post any licensing information in this forum.
I can see what the command does that you provided, but in the script I posted, I must be putting the set mgr command in the wrong place, because the script errors out.
Does that command go at the top where the ad query is, and then when you pass the value, does that go where the recordset values are setup?
You have to sonsider that I do not have your database so I cannot possibly know what you are trying to do.
Is there some reason why you cannoot get the person who wrote thsii scritp to help you. A quick lookshows that it has a large number of problems and willnotlikelywork reliably.
You can just add the line I posted along with the rest of the lines. It may not work due to other issues with the script.
It is clear that you are not someone who written scripts so it is very hard to know what it is that you have tried and what you mean by saying it doesn't work.
I can show you the code that you would need to use. I can say place it anywhere in the loop. I cannot see what you are doing and, since all error processing is turned off, the failure are impossible to know.
You will have the same issues in PowerShell.
PowerShell CodeDouble-click the code block to select all.
$managerdn=(Get-Aduser userid -properties manager),Manager
$managersamname=(Get-AdUser $managerDN ).SamAccountName
maries wrote:I won't have the same issues as I understand at least the basics, if not more with PowerShell.
I know that it's frustrating helping me out with this issue, but I stated that I had "no experience with vbscripting", and that script was written many years ago with no comments, no documentation, and yes, I know it moves on after any error basically.
All I can say is that it works as the SQL Administrator has the job scheduled and the database is populated, it ran this morning actually and we verified it pulled in new users that were created yesterday.
I tried pasting the code you provided into the script, but from what I've read the get command has to run after it pulls the user info, so that's where I got lost trying to figure out where in the code it should go.
Powershell makes logical sense to me as the commands and the syntax where VB doesn't. I do appreciate your help though, thanks again. If you have any good PowerShell learning sites, book suggestions, training videos suggestions, or otherwise, please let me know. I don't think I'll try learning VB at this point as I don't think it's needed now with Powershell.
As I have noted many times. You can place the code anywhere inside of the loop and it will work assuming there is a manager defined. Are you sure that managers have been defined?
I have no idea what or how you are pasting this. You give almost no information and describe no errors. How can anyone technically understand your issues.
If you know PowerShell then you should know these things.
With no information on what you are doing I do not see how it is possible to help you.
rs.Field("manager") = mgr.SamAccountName
I recommend contacting a consultantt to help you with this. I have answered your question as to how to get the SamAccountName of the manager, You already have proven that that works. I cannot spend time fixing all of the issues with your script. THis is not a free scripting service. It is a foru for technicians who write and maintain scripts.
I recomemnd learning VBScript r contacting a consultant who can help you.
As for the field set, if you look, you will see that it already has the "manager" specified.
VBScript CodeDouble-click the code block to select all.
SQLRecordset.Fields("manager") = GetObject("LDAP://" & adoRecordset.Fields("manager").Value).SamAccountName
Who is online
Users browsing this forum: No registered users and 4 guests