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 - How to pass credentials?

Reply
 
Old 08-20-2008   #1 (permalink)
how to display variable value?


 
 

How to pass credentials?

actually when we use get-wmiobject we pass the remote computer name but

sometimes we need the user credentials to logon to that computer . But how to

pass on the credetilas in get-wmiobject command

My System SpecsSystem Spec
Old 08-20-2008   #2 (permalink)
Kryten


 
 

Re: How to pass credentials?

Hi,

If I understand properly you want to pass your credentials to the
target computer from within the gwmi cmdlet?

If so,

gwmi -computername . -credentials "Administrator"

Will result in the username "Administrator" being presented and an
authentication dialog popped up for you to enter
the corresponding password. Note the period after the -computername
parameter to signify the local machine. Thats about it AFAIK.

It's also possible to send a credential "object" that can be
synthesised via the get-credential cmdlet, but I've never even tried
that personally.

help get-wmiobject -detailed

would be a good place to start.

Good luck,
Stuart
My System SpecsSystem Spec
Old 08-20-2008   #3 (permalink)
Wes Stahler


 
 

Re: How to pass credentials?

On Aug 20, 5:44*pm, Kryten <Kryte...@xxxxxx> wrote:
Quote:

> Hi,
>
> If I understand properly you want to pass your credentials to the
> target computer from within the gwmi cmdlet?
>
> If so,
>
> gwmi -computername . -credentials "Administrator"
>
> Will result in the username "Administrator" being presented and an
> authentication dialog popped up for you to enter
> the corresponding password. Note the period after the -computername
> parameter to signify the local machine. Thats about it AFAIK.
>
> It's also possible to send a credential "object" that can be
> synthesised via the get-credential cmdlet, but I've never even tried
> that personally.
>
> help get-wmiobject -detailed
>
> would be a good place to start.
>
> Good luck,
> Stuart
Check out this posting:
http://blogs.technet.com/robcost/arc...edentials.aspx
if you want to persist the creds.
My System SpecsSystem Spec
Old 08-21-2008   #4 (permalink)
PeterCS


 
 

Re: How to pass credentials?

On Aug 20, 4:19*pm, how to display variable value?
<howtodisplayvariableva...@xxxxxx> wrote:
Quote:

> actually when we use get-wmiobject we pass the remote computer name but
>
> sometimes we need the user credentials to logon to that computer . But how to
>
> pass on the credetilas in get-wmiobject command
I know when I write scripts that involve credentials i usually just do
the following instead of getting prompted every time i do a WMI query
in a loop or something like that.

Example:

$cred = Get-cred domain\user
#when i need to pass it i will just do the following on the gwmi
command as Kryten pointed out.
gwmi -computername pc1 -cred $cred

I find this works well if everything has the same credentials. You
could even do some logic to use one cred and if it doesn't work use
another.

I hope this helps,

PeterCS
My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Help - Credentials PowerShell
pass-through disk Virtual Server
How do I pass credentials for email to be sent through Exchange 2003 PowerShell
Why the Value not able to Pass to a Function PowerShell
How to pass credentials to Authentication Window on the web. PowerShell


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