Home:ALL Converter>Powershell remote access denied

Powershell remote access denied

Ask Time:2011-12-21T01:12:40         Author:spassen

Json Formatter

I am trying to start a service on a remote computer using the following command on the cmdlet:

(Get-WmiObject -computer atl-fs-01 Win32_Service -Filter "Name='Alerter'").InvokeMethod("StartService",$null)

When I run the command I get the error Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)). After some research it appears I need to set my username and password, but I cannot find anything that allows me to set these prior to accessing the remote computer. I also plan on making a script for this so I don't have to type out everything on the command line. PowerShell code for setting user and password would be helpful as well. Thanks.

Author:spassen,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/8579253/powershell-remote-access-denied
supermem613 :

You need to pass in the credential object (created with Get-Credential) using the \"-Credential\" switch. \n\nSee this MSDN article for more information and an example.",
2011-12-20T17:22:52
yy