TechTalkz.com Logo

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

Notices

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 - http://www.leeholmes.com/blog/default.aspx

"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
http://www.microsoft.com/mvp

PowerGadgets MVP
http://www.powergadgets.com/mvp

Blog:
http://marcoshaw.blogspot.com
  Reply With Quote
Reply

Thread Tools
Display Modes


Google
 


All times are GMT +5.5. The time now is 01:26 AM.


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