schmir1
asked on
VBScript to call Batch file with admin rights
How do I write a VBScript to call a batch file with admin rights (UAC) on a Win7 PC?
FYI: I've got a batch file called Setup_ProgFiles.bat. This batch file contains the following:
ATTRIB -R "c:\program files\*.*" /S
This is to clear the read-only attribute so my program stored there can run correctly.
FYI: I've got a batch file called Setup_ProgFiles.bat. This batch file contains the following:
ATTRIB -R "c:\program files\*.*" /S
This is to clear the read-only attribute so my program stored there can run correctly.
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
I would be part of a setup script so could I use the following a let the user enter his password?
Set objShell = WScript.CreateObject("WScr ipt.Shell" )
objShell.Run("%comspec% /c runas /user:Administrator \\myserver\folder\mybatchf ile.bat"), 0, True
I would try it but I can even get the batch file to clear the read-only even run manually.
Set objShell = WScript.CreateObject("WScr
objShell.Run("%comspec% /c runas /user:Administrator \\myserver\folder\mybatchf
I would try it but I can even get the batch file to clear the read-only even run manually.
ASKER
I never got it to work but thinks it's more of a MIT problem to fix.
http://technet.microsoft.com/en-us/magazine/2008.06.elevation.aspx