I tried that and checked again but same error.
It takes credential correctly when we give below
$ProcessClass = get-wmiobject -class "Win32_Process" -namespace "root
\cimv2" -credential $(Get-Credential) -computername $computer
But this code doesn't allow to run create( ) method to execute command
at remote machine like below.
$results = $ProcessClass.Create( $commandline )
On Apr 16, 3:37*am, RichS [MVP] <RichS...@xxxxxx>
wrote:
Quote:
> 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.
> Quote:
> > * $ProcessClass = get-wmiobject -query "SELECT * FROM Meta_Class WHERE
> > *__Class = 'Win32_Process'" -namespace "root\cimv2" -credential $(Get-
> > Credential) -computername $computer
> > * * $results = $ProcessClass.Create( $commandline )
> Quote:
> > ::::::::::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)
> Quote:
> > Any idea how to pass the credential safely?- Hide quoted text -
>
> - Show quoted text -