TechTalkz.com Logo

Go Back   TechTalkz.com Technology & Computer Troubleshooting Forums > Tech Support Archives > Microsoft > Microsoft Windows Powershell

Notices

problem with Importing Credentials in PowerShell

Microsoft Windows Powershell


Reply
 
Thread Tools Display Modes
Old 20-06-2008, 01:56 AM   #1
voodooking
Guest
 
Posts: n/a
problem with Importing Credentials in PowerShell

trying to used a secure stored credential per post
here -

"In the script that you want to run automatically, add the following commands:

$password = Get-Content c:\temp\password.txt | ConvertTo-SecureString

$credential = New-Object System.Management.Automation.PsCredential `

"CachedUser",$password
"

recieve error

New-Object : A parameter cannot be found that matches parameter name
'System.Object[]'.
At C:\SCRIPTS\test.ps1:2 char:25
+ $credential = New-Object <<<< System.Management.Automation.PsCredential `
"CachedUser",$password

i am inserting the given lines of code
and passing parameter -credential $credntial in a get-wmi-object script
  Reply With Quote
Old 20-06-2008, 01:56 AM   #2
Marco Shaw [MVP]
Guest
 
Posts: n/a
Re: problem with Importing Credentials in PowerShell

> $credential = New-Object System.Management.Automation.PsCredential `
>
> "CachedUser",$password


Try putting this all on one single line:
PS >$credential = New-Object System.Management.Automation.PsCredential
"CachedUser",$password

Marco

--
Microsoft MVP - Windows PowerShell


PowerGadgets MVP


Blog:

  Reply With Quote
Reply

Thread Tools
Display Modes



< Windows Help - MS Office Help - Hardware Support >


New To Site? Need Help?

All times are GMT +5.5. The time now is 05:49 PM.


vBulletin, Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO
Copyright © 2005-2009, TechTalkz.com. All Rights Reserved - Privacy Policy
Valid XHTML 1.0 Transitional