We received a question from someone whose mail settings did not allow a reply (see http://ops-mgr.spaces.live.com/default.aspx?_c01_BlogPart=blogentry&_c=BlogPart&handle=cns!3D3B8489FCAA9B51!541). The question was:
I have a small question about "Adding Network Devices with PowerShell" that you write about in your book.
In your example you connect NetworkDevice to $agent add-remotelymanageddevice -proxyagent $agent -device $discovery_results.custommonitoringobjects
But how I can connect NetworkDevice to Management Server (it’s not in get-agent output)?
Adding a network device to management with PowerShell does not require that you furnish the name of a management server. If we understand your question correctly, you asked about ‘connecting NetworkDevice to Management Server.’
Let’s explain the PowerShell cmdlet used in the eighth and final cmdlet in a series of cmdlets in our Powershell script that together assemble an array of inputs, and feed those inputs to the last cmdlet.
The add-remotelymanageddevice cmdlet is fed only the inputs -proxyagent and -device.
The involved management server will be the primary management server associated with the proxy agent–but that is not part of the action of adding the network device to management. We only need the name of the proxy agent.
The Discover-and-Add-Network-Devices.ps1 is a PowerShell script for discovering and adding network devices. It was developed in conjunction with Chapter 17, "Monitoring Network Devices," of System Center Operations Manager 2007 Unleashed.