Board index » Visual Studio » need a script to impersonate
|
semenu
|
|
semenu
|
need a script to impersonate
Visual Studio169
I am working on a StartUp script that checks for OU=Computers and if found moves the computer to another OU based on OScaption. I did have the foresite to create a user id and assign it to "Managed By" for the OU. My problem is that during start-up there is no user logged so my MoveHere method(?) fails. How can I have my script impersonate my OU manager? - |
| Al
Registered User |
Fri Jan 23 11:20:36 CST 2004
Re:need a script to impersonate"Sheepdog" <ng.20.shep@spamgourmet.com>wrote in message QuoteI am working on a StartUp script that checks for OU=Computers and if found kind of administrative task in a startup script rather than centrally from a management console? /Al - |
| Torgeir
Registered User |
Fri Jan 23 12:06:01 CST 2004
Re:need a script to impersonate
Sheepdog wrote:
QuoteI am working on a StartUp script that checks for OU=Computers and if found Try to connect with explicit user credentials using SWbemLocator.ConnectServer. Subject: Login with explicit username and password Newsgroups: microsoft.public.win32.programmer.wmi http://groups.google.com/groups?th" rel="nofollow" target="_blank">groups.google.com/groups=2b5bcad76f5debaa Subject: ImpersoantionLevel other than impersonate Newsgroups: microsoft.public.scripting.wsh http://groups.google.com/groups?th" rel="nofollow" target="_blank">groups.google.com/groups=89ff50603f12dcfb -- torgeir Microsoft MVP Scripting and WMI, Porsgrunn Norway Administration scripting examples and an ONLINE version of the 1328 page Scripting Guide: www.microsoft.com/technet/scriptcenter">www.microsoft.com/technet/scriptcenter - |
| Sheepdog
Registered User |
Fri Jan 23 12:46:56 CST 2004
Re:need a script to impersonate"Al Dunbar [MS-MVP]" <alan-no-drub-spam@hotmail.com>wrote in message Quote
Granted I could write a one time script to move all the current computers but what happens the next time the helpdesk adds a new PC to the network. I really want a fire and forget solution that works in real time. - |
| Al
Registered User |
Fri Jan 23 18:13:42 CST 2004
Re:need a script to impersonate"Sheepdog" <ng.20.shep@spamgourmet.com>wrote in message Quote
can be done with vbscript... QuoteGranted I could write a one time script to move all the current computers Quotebut what happens the next time the helpdesk adds a new PC to the network. they add a new PC. QuoteI really want a fire and forget solution that works in real time. to a workstation that has not yet been moved to its proper OU. Will certain things not work for the user? Why not modify the procedures used by the help desk to create the workstation account? Getting back to your original question, though, I have no idea how a script can impersonate an account with domain admin privileges without actually logging on, and am not sure if logging on could be done in the context of a startup script. But, even if it was, would you not be exposing the keys to the kingdom in this script? Considering the potential security risks and the difficulty in doing it this way, are you sure you are really going after the easiest solution? And what happens when this workstation is started up at a time when it lacks network connectivity? Suppose the local LAN is down, or the user unplugged it from the wall for some reason, or, more likely, plugged it in to an outlet that has not yet been enabled in your wiring closet? Even if you have coded the startup script to logon, it is not going to be able to. I'd still suggest modifying the helpdesk procedures, and implementing an OU check in the logon script if correctness is essential. /Al - |
| JT
Registered User |
Mon Jan 26 16:14:50 CST 2004
Re:need a script to impersonateQuote-----Original Message----- OU's. I would rather automate moving workstations into the proper OU than to trust that my Help Desk will always know where to put workstations - Let alone give them the access to add/remove workstations in every OU. Another issue with allowing the help desk to do this is the fact that in a large environment, you may not have central control over all OU's. Decentralized Help Desks normally do not have rights in other departmental OU's so I agree that automating this feature makes good sense. Sheepdog, You could possibly write the script and launch it via the RunOnce registry key. Of course, you would have to implement this into your workstation image since you want this to run at first power on. You could also encrypt the script (using the script signer) and delete it after execution so it's eyes off. A possible better way is to add this to your login script. Al is correct in the fact that if someone forgot to plug the Cat5 cable in or terminate it nothings going to happen. Something else to think about is that if you do it in a login script, you don't have to worry about impersonating someone else as the SysVol built in account will have enough rights. I know it can be done as I've worked for a company that wrote an ASP page to add users to AD without having domain admin rights. I thought it had something to do with the Impersonation Level but the MS Scripting Guide states that you cannot impersonate another user. If you find out, let me know as I also have a use for this type of functionality. Thanks, JT - |
| Al
Registered User |
Mon Jan 26 20:10:51 CST 2004
Re:need a script to impersonate"JT" <John@JTJohnson.net>wrote in message Quote
Quote>>I really want a fire and forget solution that works in helpdesk, or what have you. QuoteI would rather automate moving workstations into to add a workstation, but not give enough privs that they can complete the task. Oops, there I go again thinking that all shops are like mine... QuoteAnother issue with allowing the help desk to do this is QuoteSheepdog, You could possibly write the script and launch debug... QuoteA possible better effect. How would you go about running script in that context under the credentials of a built-in account without coding in the password somewhere? QuoteI know it can be done as I've worked for a company that destination OU, and then the service account would carry out the request (or however you managed it in your case). QuoteI thought it had something to do you can do it using RUNAS or one of the many third-party tools available to fill that need (i.e. RunAS Pro). I found the term "impersonate" a little confusing too in the context of WMI, as it conveys a somehow different impression of what it is doing. /Al - |
