Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - Creating or copying a file with alternate credentials

Reply
 
Old 09-08-2009   #1 (permalink)
T Ker


 
 

Creating or copying a file with alternate credentials

We're using a management tool to run a VBS against our machines off hours,
so most of them will not have a user logged on at the time the script runs.
Under certain circumstances we want the script to write a file to a network
share. The problem is because the management tool is running the script it
runs as SYSTEM on the PC. I need to provide domain credentials to write to
the share. Right now my script is attempting oFSO.CreateTextFile to the
share and it fails.

Is there a way to pass credentials to that? If not (and I think that will
be the case) how else might I accomplish this file write?

Thanks,

Tom



My System SpecsSystem Spec
Old 09-08-2009   #2 (permalink)
Pegasus [MVP]


 
 

Re: Creating or copying a file with alternate credentials


"T Ker" <thomasDOTkerA@xxxxxx> wrote in message
news:uHx%23V5IMKHA.1268@xxxxxx
Quote:

> We're using a management tool to run a VBS against our machines off hours,
> so most of them will not have a user logged on at the time the script
> runs. Under certain circumstances we want the script to write a file to a
> network share. The problem is because the management tool is running the
> script it runs as SYSTEM on the PC. I need to provide domain credentials
> to write to the share. Right now my script is attempting
> oFSO.CreateTextFile to the share and it fails.
>
> Is there a way to pass credentials to that? If not (and I think that will
> be the case) how else might I accomplish this file write?
>
> Thanks,
>
> Tom
The ideal solution would be to run the management tool under a domain
account in order to give it sufficient access to the share. The alternative
is to use one of the many "runas" look-alikes (e.g. sanur). This creates a
big security hole because you will have to embed a domain password in the
script.


My System SpecsSystem Spec
Old 09-09-2009   #3 (permalink)
T Ker


 
 

Re: Creating or copying a file with alternate credentials

Thanks, Pegasus.

I'm working with the built-in RunAs now and I've got this command line
working interactively...

runas /noprofile /env /user:MyDomain\DomainUser
"%SystemRoot%\System32\wscript.exe \"C:\{path}\Audit.vbs"\"

Now, how can I get the password into it?

Thanks,

Tom

"Pegasus [MVP]" <news@xxxxxx> wrote in message
news:ONwudwJMKHA.3704@xxxxxx
Quote:

>
> "T Ker" <thomasDOTkerA@xxxxxx> wrote in message
> news:uHx%23V5IMKHA.1268@xxxxxx
Quote:

>> We're using a management tool to run a VBS against our machines off
>> hours, so most of them will not have a user logged on at the time the
>> script runs. Under certain circumstances we want the script to write a
>> file to a network share. The problem is because the management tool is
>> running the script it runs as SYSTEM on the PC. I need to provide domain
>> credentials to write to the share. Right now my script is attempting
>> oFSO.CreateTextFile to the share and it fails.
>>
>> Is there a way to pass credentials to that? If not (and I think that
>> will be the case) how else might I accomplish this file write?
>>
>> Thanks,
>>
>> Tom
>
> The ideal solution would be to run the management tool under a domain
> account in order to give it sufficient access to the share. The
> alternative is to use one of the many "runas" look-alikes (e.g. sanur).
> This creates a big security hole because you will have to embed a domain
> password in the script.
>

My System SpecsSystem Spec
Old 09-09-2009   #4 (permalink)
Pegasus [MVP]


 
 

Re: Creating or copying a file with alternate credentials


"T Ker" <thomasDOTkerA@xxxxxx> wrote in message
news:OBsPn$UMKHA.5192@xxxxxx
Quote:

> Thanks, Pegasus.
>
> I'm working with the built-in RunAs now and I've got this command line
> working interactively...
>
> runas /noprofile /env /user:MyDomain\DomainUser
> "%SystemRoot%\System32\wscript.exe \"C:\{path}\Audit.vbs"\"
>
> Now, how can I get the password into it?
>
> Thanks,
>
> Tom
By using some alternate "runas" tool, e.g. sanur.exe or cpau.exe
(http://www.joeware.net/win/free/tools/cpau.htm).


My System SpecsSystem Spec
Old 09-09-2009   #5 (permalink)
Jens Hastrup


 
 

Re: Creating or copying a file with alternate credentials

Hi Tom,

If your machines are joined to a domain you can add "domain computers" to
share and ntfs rights - this would allow the system accounts of domain
joined machines to write to the share.

Jens

"T Ker" <thomasDOTkerA@xxxxxx> skrev i en meddelelse
news:uHx%23V5IMKHA.1268@xxxxxx
Quote:

> We're using a management tool to run a VBS against our machines off hours,
> so most of them will not have a user logged on at the time the script
> runs. Under certain circumstances we want the script to write a file to a
> network share. The problem is because the management tool is running the
> script it runs as SYSTEM on the PC. I need to provide domain credentials
> to write to the share. Right now my script is attempting
> oFSO.CreateTextFile to the share and it fails.
>
> Is there a way to pass credentials to that? If not (and I think that will
> be the case) how else might I accomplish this file write?
>
> Thanks,
>
> Tom
>

My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Create an AD Group with Alternate Credentials VB Script
Executing LNK files with alternate credentials PowerShell
executing ps1 from a web browser, alternate credentials PowerShell
Access denied when copying/creating file Vista General
Access denied when copying/creating file Vista General


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46