This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
do { | |
[int32]$zstart = read-host "Startzahl" | |
} while (($zstart % 2) -eq 0) | |
do { | |
[int32]$zende = read-host "Endezahl" | |
} while (($zende % 2) -eq 0) | |
[int32]$summe = 0 | |
for ($i=$zstart+2;$i -le $zende -2;$i+=2) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$hmax = read-host Maximale Länge für Hypothenuse eingeben!; | |
for ($j=1; $j -le $hmax; $j++){ | |
for ($k=1; $k -lt $j; $k++){ | |
$h= [math]::Sqrt(($j * $j)+($k * $k)); | |
if ($h % 1.0 -eq 0.0 -and $h -le $hmax){ | |
write-host $h + $j + $k; | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
param([String]$ips,[String]$subs) | |
$sub=$subs.Split(".") # Array Oktette der Subnezmaske | |
$ip=$ips.Split(".") # Array Oktelle der Netzip | |
# Netz IP bestimmen | |
$netz=0,0,0,0 | |
for ($i=0; $i -lt 4;$i++) { | |
$netz[$i]=$ip[$i] -band $sub[$i] | |
} | |
$imSubnetz=$true | |
$aktuelleIP=0,0,0,0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$port=2021 | |
$endpoint = new-object System.Net.IPEndPoint ([IPAddress]"10.13.6.100",$port) | |
$udpclient=new-Object System.Net.Sockets.UdpClient | |
$b=[Text.Encoding]::ASCII.GetBytes('Is anyone there!') | |
$bytesSent=$udpclient.Send($b,$b.length,$endpoint) | |
$udpclient.Close() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$rechnerliste = (("NAS",192,168,178,1),("Desktop PC1",192,168,178,19),("Desktop PC2",192,168,178,22),("Drucker",192,168,118,22),("WebServer",192,168,118,9),("Fileserver",192,168,118,56)) | |
$sub1= Read-Host ("1. Oktett Subnetzmaske") | |
$sub2=Read-Host ("2. Oktett Subnetzmaske") | |
$sub3=Read-Host ("3. Oktett Subnetzmaske") | |
$sub4=Read-Host ("4. Oktett Subnetzmaske") | |
$n1=$rechnerliste[0][1] -band $sub1 | |
$n2=$rechnerliste[0][2] -band $sub2 | |
$n3=$rechnerliste[0][3] -band $sub3 | |
$n4=$rechnerliste[0][4] -band $sub4 | |
Write-Host ("Netz Adresse von "+$rechnerliste[0][0]+" ist $n1.$n2.$n3.$n4") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Param( | |
[String]$file | |
) | |
function check ([String]$ipadress) { | |
#param ($ipadress) | |
$ipadress -match "(\b(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b)" | |
} | |
if ($file -ne "") { | |
$dir = Get-Location |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Datenbank Ausnahmebahandlung | |
$ok=$false | |
do { | |
try { | |
$connString = "Server=localhost;Uid=tuttas;Pwd=joerg123;database=wol"; | |
# load MySQL driver and query database | |
[void][system.reflection.Assembly]::LoadFrom("MySQL.Data.dll"); | |
$conn = New-Object MySql.Data.MySqlClient.MySqlConnection; | |
$conn.ConnectionString = $connString; | |
$conn.Open(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$connString = "Server=localhost;Uid=tuttas;Pwd=joerg123;database=wol"; | |
# load MySQL driver and query database | |
[void][system.reflection.Assembly]::LoadFrom("MySQL.Data.dll"); | |
$conn = New-Object MySql.Data.MySqlClient.MySqlConnection; | |
$conn.ConnectionString = $connString; | |
$conn.Open(); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[xml] $xml = gc "Nebenkosten.xml" | |
[float]$sum=0; | |
foreach($node in $xml.GetElementsByTagName("Haus")) | |
{ | |
$max=$node.childnodes.count | |
$item=$node.FirstChild | |
for ($i=0;$i -lt $max;$i++) { | |
$sum+=[float]$item.InnerText | |
$item=$item.NextSibling | |
} |