https://technet.microsoft.com/library/hh920227(v=sc.20).aspx

http://download.microsoft.com/download/A/0/B/A0BB6495-3010-43A8-B06C-6B0F0E8F92D9/SC2012_OpsMgr_Cmdlets.pdf

Above will have examples - which you can also see if you use PowerShell ISE and 
click the help for each cmdlet.


And remember - just bing or google a cmdlet, and you will find tons of examples 
and scripts where you can get all kinds of good ideas on syntax, outputs, and 
use cases.



From: listsadmin@lists.myitforum.com [mailto:listsadmin@lists.myitforum.com] On 
Behalf Of Orlebeck, Geoffrey
Sent: Thursday, July 30, 2015 4:27 PM
To: 'ms...@lists.myitforum.com' <ms...@lists.myitforum.com>
Subject: [msmom] RE: Discover Computer via PowerShell

Oh, bizarre. Okay. When I did "Get-SCOMAgent -DNSHostName Hostname | fl" I saw 
the 'ComputerName' property and thought I could just perform the query against 
that property.

Just tried your suggestion and it's working as expected. Thank you very much.

From: listsadmin@lists.myitforum.com<mailto:listsadmin@lists.myitforum.com> 
[mailto:listsadmin@lists.myitforum.com] On Behalf Of Brandon Ryan
Sent: Thursday, July 30, 2015 2:21 PM
To: ms...@lists.myitforum.com<mailto:ms...@lists.myitforum.com>
Subject: [msmom] RE: Discover Computer via PowerShell

Passing "-ComputerName" to the Get-SCOMAgent cmdlet will not work.  This 
parameter tells the cmdlet which SCOM server to connect to.

What you will have to do is get all agents and filter on the ComputerName 
property.

Get-SCOMAgent | ? {$_.ComputerName -eq "COMPUTERNAME" } | Do-WhatIAmGoingToDo

From: listsadmin@lists.myitforum.com<mailto:listsadmin@lists.myitforum.com> 
[mailto:listsadmin@lists.myitforum.com] On Behalf Of Orlebeck, Geoffrey
Sent: Thursday, July 30, 2015 4:15 PM
To: ms...@lists.myitforum.com<mailto:ms...@lists.myitforum.com>
Subject: [msmom] RE: Discover Computer via PowerShell

Well, I found the "System Center Data Access" service (auto-connected to the 
last host in 'services.msc', which wasn't the localhost/Management Server).

The service is running and using our designated SCOM DAS account.

Thanks,
Geoff

From: listsadmin@lists.myitforum.com<mailto:listsadmin@lists.myitforum.com> 
[mailto:listsadmin@lists.myitforum.com] On Behalf Of Orlebeck, Geoffrey
Sent: Thursday, July 30, 2015 2:13 PM
To: ms...@lists.myitforum.com<mailto:ms...@lists.myitforum.com>
Subject: [msmom] Discover Computer via PowerShell

Is there a straightforward way within the OperationsManager PowerShell module 
to discover a host by its non-FQDN name?

Example that works with FQDN:
Get-SCOMAgent -DNSHostName hostname.domain.com

However, if I don't give the FQDN, the above command won't work. I see 
"ComputerName", but when I tried it via "Get-SCOMAgent -ComputerName Hostname" 
it fails stating the Data Access service is either not running or not yet 
initialized. I'm running this on one of the Management Servers and do not see 
any "Data Access" service by ServiceName or DisplayName.

My goal is for users to be able to input a hostname and perform some tasks, but 
I don't want them to have to remember to enter the FQDN, if it's avoidable. I 
would append our domain to their entries, but we actually have several domains 
reporting to our environment, so hardcoding the appending text is not ideal 
either.

Thoughts?

Geoffrey Orlebeck
Systems Administrator II
Health Information Technology
Community Hospital of the Monterey Peninsula
PO Box HH: Monterey, CA 93942
Ph: (831) 622-2623 │ Fax: (831) 622-2608
geoffrey.orleb...@chomp.org<mailto:geoffrey.orleb...@chomp.org>

Confidentiality Notice: This is a transmission from Community Hospital of the 
Monterey Peninsula. This message and any attached documents may be confidential 
and contain information protected by state and federal medical privacy 
statutes. They are intended only for the use of the addressee. If you are not 
the intended recipient, any disclosure, copying, or distribution of this 
information is strictly prohibited. If you received this transmission in error, 
please accept our apologies and notify the sender. Thank you.

Confidentiality Notice: This is a transmission from Community Hospital of the 
Monterey Peninsula. This message and any attached documents may be confidential 
and contain information protected by state and federal medical privacy 
statutes. They are intended only for the use of the addressee. If you are not 
the intended recipient, any disclosure, copying, or distribution of this 
information is strictly prohibited. If you received this transmission in error, 
please accept our apologies and notify the sender. Thank you.


Confidentiality Notice: This is a transmission from Community Hospital of the 
Monterey Peninsula. This message and any attached documents may be confidential 
and contain information protected by state and federal medical privacy 
statutes. They are intended only for the use of the addressee. If you are not 
the intended recipient, any disclosure, copying, or distribution of this 
information is strictly prohibited. If you received this transmission in error, 
please accept our apologies and notify the sender. Thank you.




Reply via email to