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

How to Setup Software RAID on Ubuntu 20.04

Step 1: prepare to configure RAID by checking the system In the below example, we're…

Setting Up FTP on CentOS 5.3

Install VSFTPD yum -y install vsftpd   Configure: vim /etc/vsftpd/vsftpd.conf ------------------- anonymous_enable=NO // line 12:…

PowerShell: Set Autologon for Windows

Current Version: function setAutoLogon($username,$password){ $regWinlogon='REGISTRY::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon' $regKeyUsername='DefaultUserName' $regKeyPassword='DefaultPassword' $kegKeyAutologin='AutoAdminLogon' $regKeyDefaultDomain='DefaultDomain' function testCredential($username,$password){ # Get current…