This little script is what I use in cooperation with the SCOM Command Channel to parse and send SCOM alerts to a logfile. The script will take the SCOM alert parameters and put them neatly in a .log file, one file for each alert I want. This, of course, is customizable – I just like…
Read MoreRequest Template Certificates using CertReq and Powershell
Posted by frank on October 6, 2015Installing SCOM agents on non-domain servers can be a real time-consuming affair, especially the Create template-request-export-import-certificates procedure. I decided to use my basic certificate and CertReq knowlegde to create this little script that helps me automate the whole thing. NOTE: This is meant for inspiration only. If will for the most part not work in…
Read MoreGet MSMQ (Message Queuing) queues with Powershell
Posted by frank on March 16, 2015Simple, yet effective. Especially if you don’t have the MSMQ module for PS. $queues = Get-WmiObject -computername “YourServer” Win32_PerfFormattedData_msmq_MSMQQueue $queues | ft -AutoSize -property Name,MessagesInQueue – F
Read MoreQuery MSSQL with Powershell
Posted by frank on March 16, 2015I often use different variety of this snippet to do stuff with MSSQL databases (and other types as well, with minor changes to the script). The script will use SQL Auth by default. To change this to Windows Auth, change the Connection String to: $SqlConnection.ConnectionString = “Server = $SQLServer; Database = $SQLDBname; Integrated Security =…
Read MoreTest webservices with Powershell
Posted by frank on September 25, 2014I use this little thing to test webservices (by invoking SOAP/GET request etc) whenever I want to parse the output to, say, Windows Event Logs, or the nearest SoapUI installation is far far away. The $request.SetRequestHeader parameters may vary from situation to situation, but in most cases this code should be sufficient for simple Webservices….
Read MoreSCOM Agent install fails – Returncode 1603
Posted by frank on September 19, 2014My entire OpsMgr environment runs SCOM 2012 R2 UR1. Occationally I come across Windows Servers that dont have any Agents installed – or so it seems. A couple of days ago, this happened. I came across three servers without an agent, and started the Discorvery wizard. All servers was discovered successfully, and I stared to…
Read MorePowershell Unrar script v2.0!
Posted by frank on March 7, 2014This one is a little more andvanced, as it “cleans up” after itself by deleting the .rar parent folder after successfully extracting it. Of course, use this at your own risk. It tends to be a little ruthless, considering there’s no going back as soon as the parent folder is deleted. In other news: IT’S…
Read MoreList Windows Server OS
Posted by frank on February 27, 2014I always forget the correct line for listing these things with WMI. Therefore, it’s now perpetuated on Fuffle.net. =) cls $servers = get-content “C:tempserverlist.txt” foreach ($s in $servers){ $gwmi = (Get-WmiObject -ComputerName $s -class win32_operatingsystem -ErrorAction SilentlyContinue).caption write-host “$s – IP:”([System.Net.Dns]::GetHostAddresses($s)) – $gwmi -foregroundcolor “green”} -F
Read MorePowershell Ping
Posted by frank on February 24, 2014This neat little thing wil test connection for a list of pingable DNS names (URLS, switches, servers, computers, whatever), and output the result in a list with the objects IP address(es). If the ICMP ping does not reach the object, it outputs this and jumps to the next object on its list. Hurray! cls $servers…
Read MoreOutput displayname and IP address for SCOMagents
Posted by frank on January 24, 2014Got bored – wrote this little thing to output FQDN and IPaddress for all Windows and UnixLinux agents in my lab environment. Could be useful for some people maybe. ipmo operationsmanager $nixservers = get-scomclass -name “Microsoft.Unix.Computer” | Get-SCOMMonitoringObject $winservers = Get-SCOMClass -name “Microsoft.Windows.Computer” | Get-SCOMMonitoringObject Write-host “—————————————————————–” write-host “——————– Unix Computers and IPs ———————“…
Read More