/\/\o\/\/ PowerShelled

This blog has moved to http://ThePowerShellGuy.com Greetings /\/\o\/\/
$AtomFeed = ("Atom.xml")
$PreviousItems = (" PowerShell Boolean FileMode "," Working with Fixed Length delimited Text files in ... "," PowerShell and Active Directory Part 3 (UserProper... "," PowerShell and MOM 2005 "," PowerShell and Active Directory Part 2 "," PowerShel and Active Directory Part 1 "," TechEd RoundUp "," A big hurray for the Scripting Guy ! "," Teched "," PowerShell Tab Completion Part 4 "," ")

Monday, July 17, 2006

 


PowerShell and MOM2005 part 2 : Updating Settings



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 :


Comments: Post a Comment



<< Home

Archives

October 2005   November 2005   December 2005   January 2006   February 2006   March 2006   April 2006   May 2006   June 2006   July 2006   August 2006   September 2006   October 2006   November 2006   December 2006  

$Links = ("PowerShell RC1 Docs"," PowerShell RC1 X86"," PowerShell RC1 X64"," Monad GettingStarted guide"," Monad Progamming Guide"," Monad SDK"," Monad videos on Channel 9"," MSH Community Workspace"," scripts.readify.net "," MonadSource"," www.reskit.net"," PowerShell Blog"," Under The Stairs"," computerperformance powershell Home"," proudlyserving"," MSH on wikipedia"," MSHWiki Channel 9"," Keith Hill's Blog"," Precision Computing"," PowerShell for fun"," MSH Memo (Japanese)"," monadblog")

find-blog -about "PowerShell","Monad" | out-Technorati.
find-blog -contains "","" | out-Technorati.
Google
 
Web mow001.blogspot.com

This page is powered by Blogger. Isn't yours?