24 June 2009

Can't install WinRM. Access Denied

One of the pre-requisites that we need to have is WS Management 1.1 component so that we can manage non-windows machines. And most of the time, we just need to download the update and install and voi'la it works.

Not today ... I am working in a customer site which all the servers are hardened. So when I tried to install the update ... it gives me error ... Access Denied ...

Never in my mind that installing an update using Domain Administrator account will give me Access Denied.

After an hour of troubleshooting, I find the culprit. The permission for the registry entry for

Local Machine\Software\Microsoft\WINNT\Svchost

only gives Read rights for administrators hence I cannot register the WinRM service into the server.

After getting permission from customer, I set the permission to Full Control and the installation of the update works without any problem.

02 June 2009

Extract monitors,rules and object discoveries using Powershell

Wrote a Powershell script to extract the Monitors, Rules and Object Discoveries and export the names of the objects to a text file.

The method is pretty simple, I just use a couple of get-objects cmdlets and adds the criteria to match certain criteria strings and the script should.

For example, to extract monitors for Linux

$exportpath = "C:\DUMP\allLinuxmonitors.txt"
$mp = Get-ManagementPack | WHERE {$_.DisplayName -match "linux"}
foreach ($mp1 in $mp)
{
$mp1 | Format-Table DisplayName | Out-File $exportpath -Append
Get-monitor -ManagementPack $mp1 | format-table DisplayName | Out-File $exportpath -Append
}


To extract Rules for Linux

$exportpath = "C:\DUMP\allLinuxrules.txt"
$mp = Get-ManagementPack | WHERE {$_.DisplayName -match "linux"}
foreach ($mp1 in $mp)
{
$mp1 | Format-Table DisplayName | Out-File $exportpath -Append
Get-rule -ManagementPack $mp1 | format-table DisplayName | Out-File $exportpath -Append
}

To extract Object Discovery for Linux
$exportpath = "C:\DUMP\allLinuxdiscovery.txt"
Get-Discovery | WHERE {$_.DisplayName -match "linux"}| Format-Table DisplayName | Out-File $exportpath -Append


Ray just threw me a challenge ! Extract those information together with the threshold, Enabled By Default, Override values etc. Will work on it if I have time :)