Mike
asked on
Getting "Access is denied" when excuting powershell script.
I attempting to create a power shell script to stop and start a service on stand alone server (.i.e not part a AD domain) but I keep getting the following error "Get-WmiObject : Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)) . I checked and the RPC is running but it does not allow me to change the services status... Does anybody have an idea what I am missing.
$computername = "ServeName"
$service = "ServiceName"
(gwmi win32_service -computername $computername -filter "name='$service'").stopservice()
and
(gwmi win32_service -computername $computername -filter "name='$service'").startservice()
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER