WS-Man query
-
viernes, 08 de junio de 2012 18:01
I am trying to use powershell to query the WS-MAN provider on a linux host.
I have already been caught by the wsman cmdlets adding a \ to the user name. I have tried a couple of the possible workarounds and can't seem to get them to work.
I then found this article with a code example using the WSman.automation com object.
I am using the following code:
$token = Get-Credential
$wsman = new-object -com WSMan.automation
$uri = "https://XXXXXX.com:1270/wsman"
$object = "http://schemas.microsoft.com/wbem/wscim/1/cim-schema/2/SCX_OperatingSystem?__cimnamespace=root/scx"
$options = $wsman.CreateConnectionOptions()
$options.UserName = $token.UserName
$options.Password = $token.Password
$options.ProxyNoProxyServer
$flags = $wsman.sessionFlagUseBasic() -bor $wsman.sessionFlagCredUserNamePassword() -bor $wsman.sessionflagskipcacheck() -bor $wsman.sessionflagskipcncheck() -bor $wsman.sessionflagskiprevocationcheck() -bor $wsman.SessionFlagUseBasic() -bor $wsman.SessionFlagUTF8() -bor $wsman.SessionFlagUseSsl()
$session = $wsman.createSession($uri, $flags, $options)
$result = $session.enumerate($object)
$session.Error | Write-Hostand started getting access denied. I messed around with the session options and couldn't get this to change.
I then outputed the $session.Error to the host and got the following:
<f:WSManFault xmlns:f="http://schemas.microsoft.com/wbem/wsman/1/wsmanfault" Code="5" Machine="Mylocalmachine.some.CORP"><f:Message>Access is denied. </f:Message></f:WSManFault> Huh?
The access denied is coming from my local workstation? I tried to run the script as administrator which did not help. I can confirm that I can reach the remote host on 1270 via netstat on the remote host. What is happening here?
Todas las respuestas
-
domingo, 17 de junio de 2012 23:37
Michael, Do you see event ID 1002 in Operations manager event log on the management server when you try to repro the issue?
If so, You need to start over. It could be a cause of partially installed agent. Try uninstalling the agent and remove the bits. and reinstall
rpm -e scxrm -rf /etc/opt/microsoft/scxRegards
Chandan
Check my blogs at http://blogs.technet.com/chandanbharti ============================================================ Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
-
lunes, 18 de junio de 2012 16:50
The agent is fine. It is correctly responding to it's mgmt pool.
I am simply trying to write some scripts to test response for when I DO eventually have a problem.
The issue is that I am trying to query a remote machine and the access denied message appears to be generated from MY workstation, not the Remote host. Assuming that UAC is not the problem, what is specific to the WS-man config on my LOCAL workstaion that could cause this? Or is the error message
<f:WSManFault xmlns:f="http://schemas.microsoft.com/wbem/wsman/1/wsmanfault" Code="5" Machine="Mylocalmachine.some.CORP">
misleading in that the Machine identified is my LOCAL sytems, but that the access denied message is coming from the remote host?
-Mike
-
lunes, 18 de junio de 2012 17:35I would say, we are not sure what directory its trying to access and end up having access denied. i would say try running Procmon. that should give an idea.
Check my blogs at http://blogs.technet.com/chandanbharti ============================================================ Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.

