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

PowerShell: Connecting via WinRM with a Timeout

$credentials=get-credential $sessionTimeout=New-PSSessionOption -OpenTimeout 120000 # 2 minutes $sessionIncludePort=New-PSSessionOption -IncludePortInSPN -OpenTimeout 120000 $session=if($credentials){ try{ New-PSSession -ComputerName…

Add or Remove a User / Users in CentOS / Redhat Linux

sudo adduser usernamesudo passwd usernamesudo gpasswd -a username wheel#Check wheel groupsudo lid -g wheel#Delete user:userdel…

Kubernetes: Cert-Manager x509 ECDSA verification failure

Symptoms Error from server (InternalError): error when creating "kimconnect-cert.yaml": Internal error occurred: failed calling webhook…