Final version

This commit is contained in:
Alessandro Autiero
2023-09-21 16:48:31 +02:00
parent 4bba21c038
commit 73c1cc8526
90 changed files with 3204 additions and 2608 deletions

View File

@@ -1,40 +0,0 @@
[cmdletbinding(
DefaultParameterSetName = '',
ConfirmImpact = 'low'
)]
Param(
[Parameter(
Mandatory = $True,
Position = 0,
ParameterSetName = '',
ValueFromPipeline = $True)]
[String]$computer,
[Parameter(
Position = 1,
Mandatory = $True,
ParameterSetName = '')]
[Int16]$port
)
Process {
$udpobject = new-Object system.Net.Sockets.Udpclient
$udpobject.client.ReceiveTimeout = 2000
$udpobject.Connect("$computer", $port)
$a = new-object system.text.asciiencoding
$byte = $a.GetBytes("$( Get-Date )")
[void]$udpobject.Send($byte, $byte.length)
$remoteendpoint = New-Object system.net.ipendpoint([system.net.ipaddress]::Any, 0)
Try
{
$receivebytes = $udpobject.Receive([ref]$remoteendpoint)
[string]$returndata = $a.GetString($receivebytes)
If ($returndata)
{
exit 0
}
}
Catch
{
$udpobject.close()
exit 1
}
}