This blog has moved to http://ThePowerShellGuy.com
Greetings /\/\o\/\/
In the Comments about my last post about
PowerShell and MOM 2005 Pete Zerger asked about updating MOM by Using PowerShell. :
Based on the output of the '$mom | gm' command, it would appear we're limited to read-only? (I only see Get options, no Set options) I will show with some examples its also possible to update MOM2005 settings with PowerShell :
I will use get/set properties (SearchForComputers property) and Methods (ComputerIncludeList) for this :
# List available groups :
PS C:\> $mom.GetComputerGroups() | ft id,name
Id Name
-- ----
xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxfa7c28 Dell Computers
......
$dell = $mom.GetComputerGroup('xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxfa7c28')
# Update get/set property : System.Boolean SearchForComputers {get;set;}
PS C:\> $dell.SearchForComputers
True
# Set SearchForComputers to False :
PS C:\> $dell.SearchForComputers = $false
PS C:\> $dell.Update()
# Reload the Group to check if update suceeded :
PS C:\> $dell = $mom.GetComputerGroup('xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxfa7c28')
PS C:\> $dell.SearchForComputers
False
# ComputerIncludeList Property System.String[] ComputerIncludeList {get;}
# Use a Method to update the Included computerlist :
PS C:\> $dell.AddComputerToIncludeList('Server008')
PS C:\> $dell.ComputerIncludeList
Domain\Server001
Domain\Server002
Domain\Server012
Domain\Server003
Domain\Server004
Domain\Server027
Domain\Server036
Server008
PS C:\> $dell.update()
# and after the update and reload you can see It found the computer and did add it :
PS C:\> $dell = $mom.GetComputerGroup('xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxfa7c28')
PS C:\> $dell.ComputerIncludeList
Domain\Server001
Domain\Server002
Domain\Server012
Domain\Server003
Domain\Server004
Domain\Server027
Domain\Server036
Domain\Server008
as you can see from this example its also possible to update MOM2005 settings from PowerShell and you can see that some properties are only GET but you can update them by using methods, note also the use of the Update() Method.
Enjoy,
Greetings /\/\o\/\/
Tags : Monad msh PowerShell