Use PowerShell to format port query (PortQry) output

Recently I had to check connectivity to several servers on some specific ports using PortQry. As some of you already know this command will return some kind of the connectivity test report. I wanted to convert this into nice formatted table. Port Query Port Query – Display the status of TCP and UDP ports, troubleshoot TCP/IP connectivity and security, return LDAP base query info, SMTP, POP3, IMAP4 status, enumerate SQL …

PowerShell Tip of the Week: Get-Service example

Starting from today we will add also short articles with simple PowerShell examples once per week. Below you can find how to use Get-Service command against several servers and get nice formatted output. Get-Service The Get-Service cmdlet gets objects that represent the services on a local computer or on a remote computer, including running and stopped services. In this example we will limit our query to 4 properties: – MachineName …

Use PowerShell function to check if servers are accessible

Recently I had to check quickly if all of managed servers are accessible. As SCOM monitoring wasn’t set yet in my environment I had to create simple script to do that. One of the easiest method to check if server is up is to test availability of network share. Test-Path There are many ways to check if server is accessible like for example using ping, checking some specific service but …

PowerShell one-liner: Get eventlog

Use PowerShell one-liner to get eventlog details quickly and easily. In this article you will find several useful examples which will help you in daily operational tasks. Get-Eventlog The Get-EventLog cmdlet actually serves two purposes: it enables you to manage your event logs, and it also enables you to get at the events contained within those event logs. To get lognames list we just have to use parameter -list : …

Get Application Pools using PowerShell function

Getting Application Pools status remotely is relatively easy. Adding them into a data table and then sending it in html formatted report is more complex process. Today I would like to show how to do this by breaking apart one of my functions. In one of the previous articles I described how to get status of application pools and additionally reset IIS if needed – link. This time we just …

PowerShell one-liner: Find BitLocker key

As you probably know PowerShell is a powerful tool and getting BitLocker key is one of its capabilities. In this article you will find out how to use one-liner script based on ActiveDirectory module to gather BitLocker key information. The easiest way is to use Get-BitLockerVolume command but we need to have BitLocker module installed: Get-ADObject is one of the AD module commands which helps to gets an Active Directory …

Use PowerShell function to get reboot details remotely

In this article you will find useful function which will help you get reboot details from remote machines. Script use Get-WinEvent command to find reboot related log entries. Additionally it also check last reboot time and calculate it’s up time. Script will collect following information: – BootUpTime – UpTime – RebootDate – UserName – Action – Process – Reason Write-Host command has been used for displaying “UpTime” and “BootUpTime” values …

Scan event log to find if service was installed in the system

I recently had to scan system event log on all production servers to find out which services have been installed. In this article I will describe how to scan your infrastracture for this specific event. For selecting servers I used Out-GridView command: Please note that in Foreach loop you need to provide name for servers column in CSV file – in my case it was “Server name”: We have to …

Check counters values remotely using PowerShell

Today you will find out how to get counters details remotely from servers. Function is useful to check quickly if some specific counter values increased or was it just a temporary spike. Function is based on a Get-Counter command: For more information about Get-Counter you can visit MS site – link. In this function I added just basic counters: – Memory – Processor – PhysicalDisk – Network Interface Number of …

List registry key values for Microsoft Antimalware software (FEP)

Below you can find useful script for checking registry key values from remote machines. In this example we will extract information for Microsoft Anitmalware software (FEP). Script will gather following information: – Log message – Log time – Signatures Last Updated – EngineVersion – AVSignatureVersion – ASSignatureVersion First two checks are for MpCmdRun log file: %windir%\temp\MpCmdRun.log – Activity when performing scans and signature updates Output in console: To get information …