SCOM PowerShell command | Get-SCOMagent , get-scomalert, Get-SCOMManagementPack

 

Cmdlet to list out the agent 

Get-SCOMAgent

 


Get-SCOMAgent | FT -Property displayName, version, ActionAccountIdentity, ProxyingEnabled, HealthState 



Get-SCOMAgent | where {$_.healthstate -eq "success"} |select Name,healthstate, version 



Get-SCOMAgent | where {$_.healthstate -eq "warning"} | select Name,version,healthstate 

 

 

 

 

 

 

Cmdlet to get a list of Management packs


Get-SCOMManagementPack 

 

 

 

 

 

Command to get sealed and unsealed Management pack

 

Get-SCOMManagementPack |where {$_.sealed -eq "true"} |Select name, DisplayName 

 

 

Get-SCOMManagementPack |where {$_.sealed -eq "false"} |Select name, DisplayName 

 

 

 

 

 


Cmdlet to get SCOM alert

Get-SCOMAlert 




Cmdlet to get alert of particular component.


Get-SCOMAlert -Name "*heartbeat*" 

 

 

 

 

 

 

 

Cmdlet to get alert historical alert

Get-SCOMAlert -ComputerName scom | where {$_.severity -eq "error"} | FL

 

 



Automatic alert resolution in SCOM

How to configure automatic alert resolution in SCOM

In SCOM we can configure automatic alert resolution in a selected period of time.

To configure automatic alert resolution login to SCOM console

Click Administration -> Settings -> Select Alerts


 


Right click on Alerts -> Go to properties


Select Automatic Alert Resolution


Change Days for Resolve all active alerts which are in “New” resolution state after:

Change Days for Resolve all active alerts when the alert source is healthy after:



SCOM resource pool, Steps to create or modify resource pool in SCOM

 What is resource pool in SCOM and steps to create a new resource pool or modify existing resource pool. 

 

A resource pool is a collection of management servers that you can use to distribute work. ... System Center Operations Manager (SCOM) uses resource pools for load balancing and high availability among management servers.

 

Steps to create or modify resource pool in SCOM

 

 

Open SCOM console

 

Go to Administration -> Click Resource Pools

 

 

 

 

If you want to modify any existing resource pool, select the resource pool from the list

 

And click Manual Membership if you want to update from Auto to manual.

 

 

 

 

 

 

 

If you want to create resource pool, Click on create resource pool

 

 

 

 

Give the Resource pool name

 

Click next

 

 

 

Click Add -> click search

 

 

 

Once you click search, you will see a list of the management server. Select the management server from the list that you want to add in the resource pool.

 

 

 

 

Click Add and OK

 

 

Click next and create.

 


PowerShell command to list out all the VDAs registered or registered/unregistered to site and schedule it using task scheduler send the report over mail

 PowerShell command to list out all the VDAs registered or registered/unregistered to site and schedule it using task scheduler send the report over mail

The PowerShell command will be used to collect only unregistered VDAs from the site.


Get-BrokerDesktop -MaxRecordCount 5000 | Select-Object ClientName, AssociatedUserFullNames, MachineName, RegistrationState, StartTime, LastDeregistrationReason, CatalogName, LastConnectionTime, FunctionalLevel |Where-object {$_.RegistrationState -eq 'Unregistered'} | Export-Csv -Path C:\TEMP\Get-brokerDesktop.csv |Format-Table –AutoSize

 

Send-MailMessage –From administrator@ads.com –To VDA@ads.com –Subject “Guess what!” -Attachment "Get-brokerDesktop.csv" –Body “I am testing to get VDA status through PowerShell” -SmtpServer smtp.mail.com -Port 25 



Below PowerShell command will be used to collect all VDAs registered/unregistered from the site.


Get-BrokerDesktop -MaxRecordCount 5000 | Select-Object ClientName, AssociatedUserFullNames, MachineName, RegistrationState, StartTime, LastDeregistrationReason, CatalogName, LastConnectionTime, FunctionalLevel, AssociatedUserSID, HostedMachineName | Export-Csv -Path C:\TEMP\Get-broker6.csv |Format-Table -InformationAction Stop -AutoSize

 

Send-MailMessage –From administrator@ads.com –To VDA@ads.com –Subject “Guess what!” -Attachment "Get-brokerDesktop.csv" –Body “I am testing to get VDA status through PowerShell” -SmtpServer smtp.mail.com -Port 25 


If you want  more details, refer below link and update the parameters accordingly.


https://developer-docs.citrix.com/projects/citrix-virtual-apps-desktops-sdk/en/latest/Broker/Get-BrokerMachine/ 


Output will be like below.



You can schedule it using the task scheduler.

You need to save the script file in the same location where the report file is getting exported.

For me it is c:\temp

Login to server from where you want to schedule task

Open Task scheduler

Create new task -> Give task name

In security options select how you want to run the script 

In my case I have selected Run whether user is logged on or not

Check mark on Run with highest privileges.



Click on Triggers and set the scheduled time



Click on Action and in Action select start a program

In program/script browse and select powershell.exe

In arguments: give the script path with script name .ps1

Start in: Give the path where you have kept your script.



Apply OK and wait for the scheduled time, task will execute at scheduled time like below



Featured Post

HPE MSA 2040 configuration step by step

HPE MSA 2040 configuration Default IP range for HP SAN storage MSA 2040 is 10.0.0.1/2 You need to connect your laptop and storage with...