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 > PowerShell

Vista - Switch user credentials using powershell

Reply
 
Old 05-24-2009   #1 (permalink)
Danny Ni


 
 

Switch user credentials using powershell

Hi,

Is there a way to switch user credentials in powershell script? The reason I
want to do this, the script needs to access a network share that only domain
administrator can, but I don't want to login as domain administrator just
for the purpose of running the script.

TIA



My System SpecsSystem Spec
Old 05-24-2009   #2 (permalink)
Vadims Podans [MVP]


 
 

Re: Switch user credentials using powershell

right-click on PowerShell icon -> Run As... (for XP/2003), or Run As
Administrator in Vista and higher. However there is one problem, that you
cannot specify particular account name to launch program (only Administrator
is available). To solve this you can use ShellRunAs:
http://technet.microsoft.com/en-us/s.../cc300361.aspx
--
WBR, Vadims Podans
MVP: PowerShell
PowerShell blog - www.sysadmins.lv

"Danny Ni" <dndn@xxxxxx> rakstija zinojuma
"news:#$Eq$GJ3JHA.5728@xxxxxx"...
Quote:

> Hi,
>
> Is there a way to switch user credentials in powershell script? The reason
> I want to do this, the script needs to access a network share that only
> domain administrator can, but I don't want to login as domain
> administrator just for the purpose of running the script.
>
> TIA
>
My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Trouble with remote file access and passing credentials in Powershell PowerShell
problem with Importing Credentials in PowerShell PowerShell
User Accounts, Switch User, Hibernate, Sleep, Restart Vista account administration
how to get logged-in user credentials? PowerShell
Different user credentials Vista networking & sharing


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