Posts

Showing posts from February, 2023

Substrings - get domain name from FQDN

This demonstrates how to grab the domain name from an FQDN and add it as a column in a spreadsheet so you can filter on it. CLS [int]$count="" $a=get-scomclass -name "SCOM.Class.URWindowsComputer" | get-scomclassinstance | sort displayname  foreach ($i in $a) { $server=$i.path $version=$i."[SCOM.Class.URWindowsComputer].AgentVersion".value $product=$i."[SCOM.Class.URWindowsComputer].Product".value if ($product = "Microsoft Monitoring Agent") { if ($version -ne "2016 UR10" -and $version -ne "n/a") { [int]$count+=1 $start=$server.indexof('.')+1 <- clever bit $domain=$server.Substring($start) <- clever bit "$server^$domain^$product^$version" }}} write-host "Records: $count"

RDP - Where am I logged in?

This assumes you have a list of servers that you want to check if you have an RDP session on. Add the servers you want to check to a file. If it's servers in an RDCM file (*.rdg file) follow this article to get that with Powershell. Once you have the file, login to a box that has access to the servers you want to query the run this: $a=gc C:\temp\agents.txt foreach ($i in $a) {write-host -foregroundcolor yellow $i; qwinsta USER_NAME /server:$i}

Lepinja mini loaf

This is 3/4 of the original lepinja recipe. Ingredients 188gm water 1 + 1/2 tbsp milk 5-6gm yeast 289gm flour 3/4 tsp salt Method Follow main recipe Put seeds on top after it has risen in loaf tin Bake 24 mins @ 200c. Notes 20/2/2023 This is a solid recipe but it goes stale quickly so you might want to cut and freeze on the day.

Web monitoring

I had a request to monitor NetApp and Commvault management consoles, here's some notes on it. We just needed a simple availability check so I used the  Web Application Availability Monitoring  template. First of all, there's no point building this in a sealed mp because exporting/importing between management groups doesn't work well with this stuff. So build an unsealed mp in dev, then after you import to prod, re-add the Where to monitor from bit, in my case it was a resource pool. When you follow the wizard this is the info you need: Name - Whatever you put here appears in an alert as Web Application Unavailable: %Name% What to Monitor - The value for Name will appear in alerts as %Name% [Web Monitoring] Where to Monitor From - I always use mgmt servers in a dedicated resource pool, see why below View and Validate Tests - Use default values. The check every 10 mins is enough. Some notes on where you monitor sites from: "If you are going to be monitoring a large nu

Wholemeal mini loaf

This uses 100% wholemeal flour and was adapted from pg. 57 in Jack book. I halved all ingredients because I wanted a smaller loaf. Makes 1 mini loaf. Takes 1 day. Ingredients 240gm water 5gm yeast 350gm wholemeal flour 6gm salt 15gm oil Method Follow book Butter up small tin Add to tin and add seeds on top Bake for 30mins @ 200c Notes 15/2/2023 This turned out well.

Discover and monitor service names with wildcard

Some notes on discovering and monitoring services using a wildcard from Kev's article  here . I had to monitor the Commvault application and due to some upgrade issues, the services had different display names on the Commserv servers. On the agent side, not all of them had identical services installed. The one thing they all had in common was that all service names started with " Gx". There was another problem where the Commserv servers were setup in a primary/DR config. If there was a failover we'd have to manually change the monitoring.  The approach I would normally take here is to create classes for each role type and target monitors to them. It simply wasn't worth the effort due to the inconsistencies, So far this is working well. One weird thing I noticed is when it alerts it's putting {1}  for the alert name. I think this is because it's dynamically generated depending on what the service name is. Finished MP  here .

Get agents from file

This reads a file of server names and shows if it's: Windows or Linux server In the pending queue Not found clear-host $date= Get-Date $Match = 0 Write-Host Write-Host "Script Start:" $date Write-Host #New-SCOMManagementGroupConnection -ComputerName MGMT_SERVER $Servers = gc C:\temp\agents.txt #| sort $Windows = Get-SCOMAgent #| sort PrincipalName $Unix = Get-SCOMClass -Name Microsoft.Unix.Computer | Get-SCOMClassInstance #| sort DisplayName $Pending = Get-SCOMPendingManagement #| sort AgentName write-host foreach($server in $Servers) { $check = "Windows" $matchWindows = Select-String -InputObject $Windows.PrincipalName $server -Quiet $check = "Pending" $matchPending = Select-String -InputObject $Pending.AgentName $server -Quiet $check = "Unix" $matchUnix = Select-String -InputObject $Unix.DisplayName $server -Quiet If ($matchWindows -eq $true)  { $Match = $Match+1 Write-Host -ForegroundColor green $server.ToUpper() ", Windows, YES"