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

Hyper-V Set CompatibilityForMigrationEnabled

$vmName='TESTVM' function enableCpuCompatibility($vmName){ $compatibilityForMigration=(Get-VMProcessor $vmName).CompatibilityForMigrationEnabled if(!$compatibilityForMigration){ $vmIsRunning=(get-vm $vmname).State -eq 'Running' if($vmIsRunning){stop-vm $vmName} Set-VMProcessor$vmName -CompatibilityForMigrationEnabled 1…

PowerShell: Backup Dynamics CRM Organization Database

# backupCrmOrgDatabase.ps1 # This script is to be invoked in the context of the Administrator…

Optimizing Windows IIS Server

Most IIS instances are fine with default settings. However, it's often beneficial to configure some…