Hi all,

I have a vbscipt which uses cacls to set some custom permissions on a
folder. However the user that would be running the script doesn't have
sufficient rights to change the permissions. So I want to run the script
using the credentials of another user. Can anyone help?

Re: Run a vbscript with a specific set of credentials by Ray

Ray
Wed Jun 14 08:55:25 CDT 2006

Windows 2000 and above has "runas.exe" that may help. You could runas your
script.

http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/runas.mspx?mfr=true

Ray at work

"Lance" <lfkentwell@yahoo.com> wrote in message
news:%235tqgc6jGHA.4040@TK2MSFTNGP05.phx.gbl...
> Hi all,
>
> I have a vbscipt which uses cacls to set some custom permissions on a
> folder. However the user that would be running the script doesn't have
> sufficient rights to change the permissions. So I want to run the script
> using the credentials of another user. Can anyone help?
>
>



Re: Run a vbscript with a specific set of credentials by Jim

Jim
Wed Jun 14 09:05:37 CDT 2006

yeah, and that means having a username/password in plain text in the
script....
plus, "runas" wont be on older systems.

use a GPO if possible, 3rd party tools like "sanur" can do this for you...
and at the very least encode your script when youre done




"Ray Costanzo [MVP]" <my first name at lane 34 dot commercial> wrote in
message news:e8tSxo7jGHA.1936@TK2MSFTNGP04.phx.gbl...
> Windows 2000 and above has "runas.exe" that may help. You could runas
> your script.
>
> http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/runas.mspx?mfr=true
>
> Ray at work
>
> "Lance" <lfkentwell@yahoo.com> wrote in message
> news:%235tqgc6jGHA.4040@TK2MSFTNGP05.phx.gbl...
>> Hi all,
>>
>> I have a vbscipt which uses cacls to set some custom permissions on a
>> folder. However the user that would be running the script doesn't have
>> sufficient rights to change the permissions. So I want to run the script
>> using the credentials of another user. Can anyone help?
>>
>>
>
>



Re: Run a vbscript with a specific set of credentials by Jonamba

Jonamba
Fri Jun 23 23:28:45 CDT 2006

>
> I have a vbscipt which uses cacls to set some custom permissions on a
> folder. However the user that would be running the script doesn't have
> sufficient rights to change the permissions. So I want to run the script
> using the credentials of another user. Can anyone help?
>

Runasspc will start your script with other credentials than the
logged-on user. The login information for the script like username and
password are read from an encrypted file. The tool is easy to use and don t
need an installation.
You find it on www.robotronic.de/runasspcen.html




Re: Run a vbscript with a specific set of credentials by W

W
Tue Jun 27 19:37:39 CDT 2006

'VBRUNAS.VBS
'v1.3 March 2003
'Jeffery Hicks
'jhicks@jdhitsolutions.com http://www.jdhitsolutions.com
'USAGE: cscript|wscript VBRUNAS.VBS Username Password Command
'DESC: A RUNAS replacement to take password at a command prompt.
'NOTES: This is meant to be used for local access. If you want to run a
command
'across the network as another user, you must add the /NETONLY switch to the
RUNAS
'command.

'
*********************************************************************************
' * THIS PROGRAM IS OFFERED AS IS AND MAY BE FREELY MODIFIED OR ALTERED AS
*
' * NECESSARY TO MEET YOUR NEEDS. THE AUTHOR MAKES NO GUARANTEES OR
WARRANTIES, *
' * EXPRESS, IMPLIED OR OF ANY OTHER KIND TO THIS CODE OR ANY USER
MODIFICATIONS. *
' * DO NOT USE IN A PRODUCTION ENVIRONMENT UNTIL YOU HAVE TESTED IN A
SECURED LAB *
' * ENVIRONMENT. USE AT YOUR OWN RISK.
*
'
*********************************************************************************

On Error Resume Next
dim WshShell,oArgs,FSO

set oArgs=wscript.Arguments

if InStr(oArgs(0),"?")<>0 then
wscript.echo VBCRLF & "? HELP ?" & VBCRLF
Usage
end if

if oArgs.Count <3 then
wscript.echo VBCRLF & "! Usage Error !" & VBCRLF
Usage
end if

sUser=oArgs(0)
sPass=oArgs(1)&VBCRLF
sCmd=oArgs(2)

set WshShell = CreateObject("WScript.Shell")
set WshEnv = WshShell.Environment("Process")
WinPath = WshEnv("SystemRoot")&"\System32\runas.exe"
set FSO = CreateObject("Scripting.FileSystemObject")

if FSO.FileExists(winpath) then
'wscript.echo winpath & " " & "verified"
else
wscript.echo "!! ERROR !!" & VBCRLF & "Can't find or verify " & winpath
&"." & VBCRLF & "You must be running Windows 2000 for this script to work."
set WshShell=Nothing
set WshEnv=Nothing
set oArgs=Nothing
set FSO=Nothing
wscript.quit
end if

rc=WshShell.Run("runas /user:" & sUser & " " & CHR(34) & sCmd & CHR(34), 2,
FALSE)
'new code from Nick Staff (nstaff@angelsin.com) to loop until window opens.

Do until WshShell.AppActivate (WinPath)
Wscript.Sleep 5
WshShell.AppActivate (WinPath)
loop
WshShell.SendKeys sPass


set WshShell=Nothing
set oArgs=Nothing
set WshEnv=Nothing
set FSO=Nothing

wscript.quit

'************************
'* Usage Subroutine *
'************************
Sub Usage()
On Error Resume Next
msg="Usage: cscript|wscript vbrunas.vbs Username Password Command" & VBCRLF
& VBCRLF & "You should use the full path where necessary and put long file
names or commands" & VBCRLF & "with parameters in quotes" & VBCRLF & VBCRLF
&"For example:" & VBCRLF &" cscript vbrunas.vbs jdhitsolutions\jhicks
luckydog e:\scripts\admin.vbs" & VBCRLF & VBCRLF &" cscript vbrunas.vbs
jdhitsolutions\jhicks luckydog " & CHR(34) &"e:\program
files\scripts\admin.vbs 1stParameter 2ndParameter" & CHR(34)& VBCRLF &
VBCRLF & VBCLRF & "cscript vbrunas.vbs /?|-? will display this message."

wscript.echo msg

wscript.quit

end sub
"Jonamba Sum" <Sum.Jonamba@ts-micado.net> wrote in message
news:449cbf78$0$4151$ed362ca5@nr1.newsreader.com...
> >
>> I have a vbscipt which uses cacls to set some custom permissions on a
>> folder. However the user that would be running the script doesn't have
>> sufficient rights to change the permissions. So I want to run the script
>> using the credentials of another user. Can anyone help?
>>
>
> Runasspc will start your script with other credentials than the
> logged-on user. The login information for the script like username and
> password are read from an encrypted file. The tool is easy to use and don
> t need an installation.
> You find it on www.robotronic.de/runasspcen.html
>
>
>