Posted On December 16, 2020

PowerShell: Probe Remote Machine for Its OS Type

kimconnect 0 comments
blog.KimConnect.com >> Codes , Linux >> PowerShell: Probe Remote Machine for Its OS Type
function probeOsType($server){
	$ping=test-connection $server -count 1
	$ttl=$ping.ResponseTimeToLive
	$osType=switch($ttl){
 			{$_ -le 64} {"Linux"; break} # MacOs TTL default is also 64, but we don't count toys
 			{$_ -le 128} {"Windows"; break}
 			{$_ -le 255} {"UNIX"; break}
		}
	return $osType
}

probeOsType REMOTECOMPUTER

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post

Linux: How to Install ProFTPd on CentOS 8 as an SFTP Server

Introduction: While this article focuses on the installation and configuration aspects of SFTP via the…

PowerShell: Error While Invoking Functions Containing 2 Parameters

Issue: This function will raise an error when being invoked: function localFunc ($x, $y){ begin{}…

PowerShell: Get All Hyper-V Host Spectre Patch Versions

# getAllVmSpectrePatchVersions.ps1 function getHyperVHostsInForest{ function includeRSAT{ $ErrorActionPreference='stop' [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 #$rsatWindows7x32='https://download.microsoft.com/download/4/F/7/4F71806A-1C56-4EF2-9B4F-9870C4CFD2EE/Windows6.1-KB958830-x86-RefreshPkg.msu' $rsatWindows7x64='https://download.microsoft.com/download/4/F/7/4F71806A-1C56-4EF2-9B4F-9870C4CFD2EE/Windows6.1-KB958830-x64-RefreshPkg.msu' $rsatWindows81='https://download.microsoft.com/download/1/8/E/18EA4843-C596-4542-9236-DE46F780806E/Windows8.1-KB2693643-x64.msu' $rsat1709 =…