Frustrated with SCOM powershell, why is this failing.
Can somebody tell me WHY am I getting this error? I'm trying to perform a discovery via the powershell command 'start-discovery' so I can build a text file with the scan results. But the darn thing just won't accept the value I'm entering for '-ManagementServer' in any shape. It keeps spewing out this error: >start-discovery cmdlet start-discovery at command pipeline position 1 Supply values for the following parameters: ManagementServer: dwmomrms01 Start-Discovery : Cannot bind parameter 'ManagementServer'. Cannot convert value "dwmomrms01" to type "Microsoft.EnterpriseManagement.Administration.ManagementServer". Error: "Invalid cast from 'System.String' to 'Microsoft.EnterpriseManagement.Administration.ManagementServer'. At line:1 char:15 + start-discovery <<<< PS Monitoring:\dwmomrms01.dorseylaw.corp >start-discovery cmdlet start-discovery at command pipeline position 1 Supply values for the following parameters: ManagementServer: dwmomrms01.dorseylaw.corp Start-Discovery : Cannot bind parameter 'ManagementServer'. Cannot convert value "dwmomrms01.dorseylaw.corp" to type "Microsoft.EnterpriseManagement.Administration.ManagementServer". Error: "Invalid cast from 'System.String' to 'Microsoft.EnterpriseManagement.Administration.ManagementServer'. At line:1 char:15 + start-discovery <<<< What the heck am I suppose to enter on the ManagementServer field?
March 18th, 2010 7:18pm

This is failing because the Start-Discovery cmdlet is looking for a Management Server as an object, and you are passing the management server name in the form of a string. An easy way to get the management server as an object and assign it to a variable would be: $myMS = Get-ManagementServer |Where {$_.Name -eq 'dwmomrms01'}Then you could run your start-discovery cmdlet with: start-discovery $myMS .....www.operatingquadrant.com
Free Windows Admin Tool Kit Click here and download it now
March 18th, 2010 7:34pm

Still not working. If I do this: $rootManagementServer = Get-ManagementServer | Where {$_.Name -eq 'dwmomrms01'} And I try to run the discovery with: Start-Discovery -ManagementServer: $rootManagementServer -WindowsDiscoveryConfiguration: $discoveryConfig I get the following: Start-Discovery : The argument cannot be null or empty. At line:1 char:35 + Start-Discovery -ManagementServer: <<<< $rootManagementServer -WindowsDiscoveryConfiguration: $discoveryConfig
March 18th, 2010 8:00pm

Hi,I'm not a god of powershell synthax but what if you remove the ":" ? Start-Discovery -ManagementServer $rootManagementServer -WindowsDiscoveryConfiguration $discoveryConfig Regards,François DufourMy Blog
Free Windows Admin Tool Kit Click here and download it now
March 18th, 2010 8:10pm

I would suspect this is because the Management Server name is actually in the form of a fully qualified domain name. Try:$rootManagementServer = Get-ManagementServer | Where {$_.Name -match 'dwmomrms01'}You can run: Get-ManagementServer |ft Name to see the list of management server name properties.www.operatingquadrant.com
March 18th, 2010 8:14pm

shouldn't it be -like than...But since the TS apperently wants the rms:$rootManagementServer = Get-RootManagementServerRob Korving http://jama00.wordpress.com/
Free Windows Admin Tool Kit Click here and download it now
March 18th, 2010 10:08pm

KrisBash, You nailed it, using -match instead of -eq seems to have done the trick and got me past the error. Now I'm trying to figure out why I'm not getting any results back from the discovery. :)
March 18th, 2010 10:22pm

I'm still not able to accomplish what I want. I'm trying to perform an Active Directory discovery of servers that don't have the monitoring agent installed. I want to do this via Powershell so that I can redirect the list of servers the discovery process will produce to a flat file. I'm using the information provided by these 2 links. http://tarek-online.blogspot.com/2007/07/how-to-schedule-discover-and-install.html and http://social.technet.microsoft.com/Forums/en-US/systemcenterdeployment/thread/54d3cb72-3917-4fd4-873b-2581f9bc3dab and I'm using the following: $rootMS = "dwmomrms01.dorseylaw.corp" # Initialize the OpsMgr Provider Add-PSSnapin Microsoft.EnterpriseManagement.OperationsManager.Client # Set the location to the root of the provider namespace. cd OperationsManagerMonitoring:: #create a connection to the Management Group New-ManagementGroupConnection $rootMS #change the path cd $rootMS # Get the Root Management Server Object $rootManagementServer = Get-ManagementServer | Where {$_.Name -match 'dwmomrms01'} # Set Domain variable $Domain = "dorseylaw.corp" # Create LDAP query to be used for discovery $LDAPQuery = New-LdapQueryDiscoveryCriteria -domain $Domain -ldapquery "(samAccountType=805306369)(cn=*mp*)" # Setup discovery config $discoveryConfig = New-WindowsDiscoveryConfiguration -ldapquery $LDAPQuery #Start discovery and add results to $discoveryResults $discoveryResult = Start-Discovery -ManagementServer: $rootManagementServer –WindowsDiscoveryConfiguration: $discoveryConfig Output discovered servers to file $discoveryResult.CustomMonitoringObjects > "C:\DiscoveredServers.txt" The problem is that when I execute the last line I don't get anyting on the file because the CustomMonitoringObjects is empty. If I do just $discoveryresults this is what it shows: >$discoveryResults BatchId MonitoringTaskResults CustomMonitoringObjects ------- --------------------- ----------------------- 402cb078-a2cc-4e21-bb0a-... {b7cbd0fa-c77b-48f0-a57e... {} I'm not sure what else to do and I'm at the end of the rope, this has taken me 10 times longer than I had anticipated so far. I'll appreciate some help, not looking forward to manually building a list of servers.
Free Windows Admin Tool Kit Click here and download it now
March 18th, 2010 11:49pm

Due to inactivity marked as Answered. Feel free to re-openCheers, Arie de Haan This posting is provide "AS IS" with no guarantees, warranties, rigths etc. 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.
July 14th, 2010 11:40pm

HI there, is there any continuation to this thread. cos i tried what is written above, but it dint worked for me. I wish if some could check this post and update the thread.. ~manishManishi
Free Windows Admin Tool Kit Click here and download it now
November 7th, 2010 8:30am

Try the question over here: http://social.technet.microsoft.com/Forums/en/ITCG/threads Cheers, John Bradshaw
November 8th, 2010 1:55am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics