This has come up before if I remember correctly. You need to do the
get-credential as a seperate prior step
$cred = get-credential
get-wmiobject ........... -credentials $cred ..........
--
Richard Siddaway
All scripts are supplied "as is" and with no warranty
PowerShell MVP
Blog:
http://richardsiddaway.spaces.live.com/
PowerShell User Group:
http://www.get-psuguk.org.uk
"Amit Tank" wrote:
Quote:
> I want to execute a command at remote DMZ server with below line. But
> it is not authenticating the password and giving access denied error
> even though password is correct & able to access remote share with
> same password.
>
> $ProcessClass = get-wmiobject -query "SELECT * FROM Meta_Class WHERE
> __Class = 'Win32_Process'" -namespace "root\cimv2" -credential $(Get-
> Credential) -computername $computer
> $results = $ProcessClass.Create( $commandline )
>
> ::::::::::Error :::::::::
> Exception retrieving member "Create": "Access is denied. (Exception
> from HRESUL
> T: 0x80070005 (E_ACCESSDENIED))"
> At C:\ExeCmd.ps1:72 char:11
> + $results = <<<< $ProcessClass.Create($commandline)
>
> Any idea how to pass the credential safely?
>