Clint Huffman's Windows Performance Blog

Clint Huffman's Windows Performance Blog

Helpful PowerShell One-Liners

Helpful PowerShell One-Liners

  • Comments 1
  • Likes

While doing a BizTalk Health check this week, the customer and I thought it would be cool to try to do as much as possible in an interactive PowerShell session to collect the data we needed. We created a lot of PowerShell one-liners and I thought I’d share it. These one-liners use WMI, so nearly all of them can be ran from a remote workstation, so this means that PowerShell is not needed on the remote BizTalk servers unless otherwise noted.

Be careful of word wrap in this email. All of these commands are *one-liners* – meaning they all go on one line ;-).

# List of BizTalk Servers. This is needed, so that the rest of the commands will execute on each of them per command.

$BizTalkServers = "BizTalkServer1","BizTalkServer2"

# Ping servers (latency check)

$BizTalkServers | foreach-object {"================";$_;"================";ping $_}

# Pathping (packet loss check)

$BizTalkServers | foreach-object {"================";$_;"================";pathping $_}

# Get Total Physical Memory

$BizTalkServers | ForEach-Object {"================";$_;"================";Get-wmiobject -Query "SELECT TotalPhysicalMemory FROM Win32_ComputerSystem" -ComputerName $_} | Format-List TotalPhysicalMemory

# Installed hotfixes (quick)

$BizTalkServers | ForEach-Object {"================";$_;"================";Get-wmiobject -Query "SELECT HotFixID,ServicePackInEffect FROM Win32_QuickFixEngineering" -ComputerName $_} | Format-list HotfixID, ServicePackInEffect

# NumberOfProcessors

$BizTalkServers | ForEach-Object {"================";$_;"================";Get-wmiobject -Query "SELECT NumberOfProcessors FROM Win32_ComputerSystem" -ComputerName $_} | Format-List NumberOfProcessors

# System Information

$BizTalkServers | ForEach-Object {"================";$_;"================";Get-wmiobject -Query "SELECT Caption, CSDVersion, MaxProcessMemorySize, PAEEnabled, ServicePackMajorVersion FROM Win32_OperatingSystem" -ComputerName $_} | Format-List Caption, ServicePackMajorVersion, CSDVersion, MaxProcessMemorySize, PAEEnabled

# Clock Synchronization Check

$BizTalkServers | ForEach-Object {"================";$_;"================";Get-wmiobject -Query "SELECT * FROM Win32_LocalTime" -ComputerName $_} | format-list Year, Month, Day, Hour, Minute, Second

# BizTalk Host Instance information (WMIC) (Must be ran locally) (WMIC is native to the operating system)

wmic /NAMESPACE:"\\root\MicrosoftBizTalkServer" PATH MSBTS_HostInstance GET HostName, HostType, Logon, NTGroupName, RunningServer

# BizTalk Host Instance information (PowerShell) (Must be ran locally) (PowerShell must be installed)

$BizTalkServers | ForEach-Object {"================";$_;"================";Get-wmiobject -Namespace "root\MicrosoftBizTalkServer" -Query "SELECT * FROM MSBTS_Host" -ComputerName $_} | Format-List HostName, HostType, Logon, NTGroupName, RunningServer

Comments
Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment