Trying to understand Remote WMI permissions



  • 1. How to write to sharepoint workspace
    I'm running a ps-script to collect mailboxinformation from Exchange2007 and want to write the oputput file directly to a a sharepoint workspace. Does anyone know how to do this? Thanks in advance Rudi
  • 2. Newbie Question: Basic select-object Question.
    Newbie alert. Hi, I am still a beginner at this, so excuse this basic question if it was answered. I read the docs, search through google and cannot find an answer to this. How to I capture the string only from the select-object output. For example. > get-process -name g* Handles NPM(K) PM(K) WS(K) VM(M) CPU(s) Id ProcessName ------- ------ ----- ----- ----- ------ -- ----------- 141 23 30480 27500 546 0.45 4928 GOContactSync I would like to capture the process name only. > get-process -name g* | select-object ProcessName ProcessName ----------- GOContactSync How do I capture the value only "GOContactSync" and not the "ProcessName" headline? Any pointers would be greatly appreciated. Thanks.
  • 3. How to pass parameters with double quotes to external command
    I have an external command that requieres double quotes as part of it's parameters like rsm.exe test.cpp -O"report.csv" How do I pass the quotes to the command with powershell? Using the echoargs.exe utility I tried the following echoargs.exe "Test" -> Arg 0 is <Test> echoargs.exe ""Test"" -> Arg 0 is <Test> echoargs.exe '"Test"' -> Arg 0 is <Test> echoargs.exe "Te""st" -> Arg 0 is <Test> echoargs.exe "Te`"st" -> Arg 0 is <Test> So no matter what I am doing, powershell seems to strip the double quotes from the parameters passed to the external command. What shall I do? -- Regards, Bernd

Trying to understand Remote WMI permissions

Postby SmFuc3Nlbg » Thu, 27 Sep 2007 04:34:03 GMT

Hello.  I've been tasked with querying, starting, and stopping services on a 
remote machine using a machine-specific local account on the remote machine.  
I've decided than an easy way to do this would be to use Powershell:

$cred = get-cred (to be stored later on in an encrypted text file)
gwmi win32_service -cred $cred -comp computer | ? {$_.Name -like "Myservice"}

However, I'm having trouble figuring out what permissions are needed to make 
a remote WMI call in Powershell.  When I add the said account to the 
computer's administrator group, it works.  But when the account is in the 
user group, the gwmi call fails with access denied.  I don't want to make 
that account an admin account.  I only want it to be able to start, stop, and 
query services, which I've delegated through a GPO.

I've tried opening the WMI Control in Computer Management, and as a test, 
granted the account write/execute/remote enable/etc. at the root level, and 
propagated the changes down, but that doesn't work, so I'm thinking there 
must be some other permission required in order for gwmi to work remotely for 
a non-admin account.  Any ideas as to what I'm missing?  I know the question 
isn't SPECIFICALLY a Powershell question, but I'm not sure where else I'd 
post the question.

Thanks in advance,

Janssen Jones

Re: Trying to understand Remote WMI permissions

Postby Marco Shaw » Thu, 27 Sep 2007 10:40:20 GMT

Just in case...  Read this since you're asking about WMI and credentials:


PowerGadgets MVP


Similar Threads:

1.DCOM and WMI remote permission denied

2.DCOM and WMI remote permission denied - fixitchri

I am having the same issue but I cannot locate the registry key you are referring to, please can you explain in more detail.

Kind regards


3.WMI remote permissions error

If I run this:

gwmi win32_process -computer "COMPUTER" -credential "DOMAIN\USER"

And provide the proper password then I get a permission denied error. 
However if I do essentially the exact same thing in VBScript:

On Error Resume Next
Dim strComputer
Dim objWMIService
Dim propValue
Dim objItem
Dim SWBemlocator
Dim UserName
Dim Password
Dim colItems

strComputer = "COMPUTER"
UserName = "DOMAIN\USER"
Password = "PASSWORD"
Set SWBemlocator = CreateObject("WbemScripting.SWbemLocator")
Set objWMIService = 
Set colItems = objWMIService.ExecQuery("Select * from Win32_Process",,48)
For Each objItem in colItems
	WScript.Echo "Caption: " & objItem.Caption
	WScript.Echo "CommandLine: " & objItem.CommandLine
	WScript.Echo "CreationClassName: " & objItem.CreationClassName
	WScript.Echo "CreationDate: " & objItem.CreationDate
	WScript.Echo "CSCreationClassName: " & objItem.CSCreationClassName
	WScript.Echo "CSName: " & objItem.CSName
	WScript.Echo "Description: " & objItem.Description
	WScript.Echo "ExecutablePath: " & objItem.ExecutablePath
	WScript.Echo "ExecutionState: " & objItem.ExecutionState
	WScript.Echo "Handle: " & objItem.Handle
	WScript.Echo "HandleCount: " & objItem.HandleCount
	WScript.Echo "InstallDate: " & objItem.InstallDate
	WScript.Echo "KernelModeTime: " & objItem.KernelModeTime
	WScript.Echo "MaximumWorkingSetSize: " & objItem.MaximumWorkingSetSize
	WScript.Echo "MinimumWorkingSetSize: " & objItem.MinimumWorkingSetSize
	WScript.Echo "Name: " & objItem.Name
	WScript.Echo "OSCreationClassName: " & objItem.OSCreationClassName
	WScript.Echo "OSName: " & objItem.OSName
	WScript.Echo "OtherOperationCount: " & objItem.OtherOperationCount
	WScript.Echo "OtherTransferCount: " & objItem.OtherTransferCount
	WScript.Echo "PageFaults: " & objItem.PageFaults
	WScript.Echo "PageFileUsage: " & objItem.PageFileUsage
	WScript.Echo "ParentProcessId: " & objItem.ParentProcessId
	WScript.Echo "PeakPageFileUsage: " & objItem.PeakPageFileUsage
	WScript.Echo "PeakVirtualSize: " & objItem.PeakVirtualSize
	WScript.Echo "PeakWorkingSetSize: " & objItem.PeakWorkingSetSize
	WScript.Echo "Priority: " & objItem.Priority
	WScript.Echo "PrivatePageCount: " & objItem.PrivatePageCount
	WScript.Echo "ProcessId: " & objItem.ProcessId
	WScript.Echo "QuotaNonPagedPoolUsage: " & objItem.QuotaNonPagedPoolUsage
	WScript.Echo "QuotaPagedPoolUsage: " & objItem.QuotaPagedPoolUsage
	WScript.Echo "QuotaPeakNonPagedPoolUsage: " & 
	WScript.Echo "QuotaPeakPagedPoolUsage: " & objItem.QuotaPeakPagedPoolUsage
	WScript.Echo "ReadOperationCount: " & objItem.ReadOperationCount
	WScript.Echo "ReadTransferCount: " & objItem.ReadTransferCount
	WScript.Echo "SessionId: " & objItem.SessionId
	WScript.Echo "Status: " & objItem.Status
	WScript.Echo "TerminationDate: " & objItem.TerminationDate
	WScript.Echo "ThreadCount: " & objItem.ThreadCount
	WScript.Echo "UserModeTime: " & objItem.UserModeTime
	WScript.Echo "VirtualSize: " & objItem.VirtualSize
	WScript.Echo "WindowsVersion: " & objItem.WindowsVersion
	WScript.Echo "WorkingSetSize: " & objItem.WorkingSetSize
	WScript.Echo "WriteOperationCount: " & objItem.WriteOperationCount
	WScript.Echo "WriteTransferCount: " & objItem.WriteTransferCount

Then it works just fine. Is this a known issue with powershell? Is there 
some Powershell setting that is preventing this?

4.Permission Denied when trying to access remote computer with V

5.Permission Denied when trying to access remote computer with VBScr


i'm writing a script that access WMI on a remote computer to perform certain 
actions. i've tried using the GetObject as follows:

	Set objWMIService = GetObject _
	    ("winmgmts:{impersonationLevel=impersonate,(Shutdown)}\\" & _
	        strComputerName & "\root\cimv2")

and i've also tried using whe sWbemLocator ConnectServer method as follows:

Set objSWbemLocator = CreateObject("WbemScripting.sWbemLocator") 
Set objWMIService = objSWbemLocator.ConnectServer(strComputerName, _ 
    "\root\CIMV2", _ 
    strUser, _ 
    strPassword,  _ 
    "MS_409", _ 
    "NTLMDomain:" + strComputerName) 

when i use the first method, i get 
error code: 800A0046
Error: Permission denied: 'GetObject'
System: the remote server has been paused or is in the process of being 

when i use the second method, i get:
error Code: 80070005
Error: Access is denied
Source: SWbemLocator
System: Access is denied

the remote computer is a Windows XP sp2, i'm running a network with a 
windows 2003 domain controler. i'm running the script as a domain 
i have searched all around on a way to fix this. i have followed all 
instructions in how to set securiy and impersonation level, and access level, 
and still my scripts error out.
i suspect that some recent windows update is blocking access to local wmi 
from the network.
all the variables are declared explicitly and are assigned values before 
reaching this part of the code.
i have disabled the firewall on the local machines using a gpo, so it's not 
a firewall issue.
if i'm locally on the machine, all the scripts run without a problem. it's 
only remotely that i have a problem.

thanks and regards,

6. Understanding WMI coding

7. Need to understand permissions and ownership

8. Need to understand permission and ownership

Return to powershell


Who is online

Users browsing this forum: No registered users and 70 guest