Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pass through credentials

Status
Not open for further replies.

Jerz

MIS
Sep 10, 2004
102
0
0
US
'###########################
' Rename Computer
'###########################
rc = objWMIComputerSystem.Rename(strNewComputer, _
strDomainPasswd, _
strDomainUser)

I'm re-naming a machine, which works fine as above. Company Policy prohibits storing passwords & usernames in the script.

When I run the script as:
rc = objWMIComputerSystem.Rename(strNewComputer)
as a domain admin, I get error 5, access denied.

It does work if I code in some creds, but that isn't acceptable. How to use current windows users credentials in script?

David J.
 
I realize this doesnt answer you question directly but its a work around that i use frequently. Compile the script into an exe so its not readable and you can code credentials into the script. Its cheap and has worked great even with complicated vbs scripts or simple batch files. I understand its not bullet proof, but most users dont try to decompile exe files.




RoadKi11

"This apparent fear reaction is typical, rather than try to solve technical problems technically, policy solutions are often chosen." - Fred Cohen
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top