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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB Script, Impersonate Administrator to set security

Status
Not open for further replies.

scotitpulsa

IS-IT--Management
Oct 1, 2003
61
US
I have a script at login that I want to delete files from the root of C but permission is denied. Can someone throw me a bone on how to impersonate administrator or the like so the script can run, then turn off the impersonation after the files delete? Thanks in advance...here is the snippet of my script:

'dim feedback_old, intranet_old, nextish_old, pulsabg_old

'feedback_old = "c:\documents and settings\all users\desktop\feedback.url"
'intranet_old = "c:\documents and settings\all users\desktop\Rochester Intranet.url"
'nextish_old = "c:\nextish.ico"
'pulsabg_old = "c:\pulsabg.gif"

'if fs.fileexists(feedback_old) = true then
' set feedback_old = fs.GetFile(feedback_old)
' feedback_old.delete [force]
'end if

'if fs.fileexists(nextish_old) = true then
' set nextish_old = fs.GetFile(nextish_old)
' nextish_old.delete [force]
'end if
 
why not run the script with run as.....I take it you're calling the vbscript using cscript <script name>
 
Try this thread. The program has helped a lot of people....

thread779-676827
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top