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
function ipclass ([string]$ip) { | |
[array]$x = $ip.Split(".") | |
if($x[0] -le 127) | |
{ | |
return "A"; | |
} | |
if($x[0] -gt 127 -and $x[0] -le 191) | |
{ | |
return "B"; | |
} |
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
cls | |
$gebTag = New-Object System.DateTime(1968,4,11) | |
$today = Get-Date | |
$gebTag=$gebTag.AddYears($today.Year-$gebTag.Year) | |
for ($i=0;$i -lt 50;$i++) { | |
$gebTag=$gebTag.AddYears(1); | |
if ($gebTag.DayOfWeek -eq "Sunday") { | |
Write-Host ("Du hast im Jahr "+$gebTag.Year+" wieder auf einen Sonntag Geburtstag") | |
} |
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
<rechnernetz subnet="255.255.255.0" > | |
<pc mac="23:cd:11:f1:2a:22"> | |
<ip>192.168.178.2</ip> | |
<name>Franks Desktop</name> | |
</pc> | |
<pc mac="23:cd:11:f1:2a:23"> | |
<ip>192.168.178.3</ip> | |
<name>Franks Notebook</name> | |
</pc> | |
<router mac="23:cd:11:f1:2a:24"> |
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]$a = Get-Content ("D:\Dropbox\temp\rechnernetz.xml") | |
$pc=$a.CreateElement("pc") | |
$pc.SetAttribute("mac","12:33:ef:ff:a2:7a") | |
$ip=$a.CreateElement("ip") | |
$ip.innerText="192.168.178.7" | |
$pc.AppendChild($ip) | |
$name=$a.CreateElement("name") | |
$name.innerText="Franks Tablet" | |
$pc.AppendChild($name) | |
$a.rechnernetz.AppendChild($pc) |
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
cls | |
[xml]$a = Get-Content ("D:\Dropbox\temp\rechnernetz.xml") | |
$n = $a.SelectNodes("//pc") | |
foreach ($p in $n) { | |
if ($p.name -eq "Franks Notebook") { | |
$p.ip="192.168.178.10" | |
} | |
} | |
$a.Save("D:\Dropbox\Temp\rechnernetz_neu.xml") |
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
cls | |
[xml]$a = Get-Content ("schulklasse_zeugnis.xml") | |
$n = $a.SelectNodes("//pupil") | |
foreach ($p in $n) { | |
$sum=0 | |
$z=$p.zeugnis.FirstChild | |
do { | |
if ($z.Name -ne "fehlzeiten") { | |
$sum=$sum+$z.InnerText |
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
cls | |
$webClient = new-object System.Net.WebClient | |
$mmbbs = Read-Host ("Sind sie in der Schule hinter dem Proxy? j/n") | |
if ($mmbbs -eq "j") { | |
$proxy = new-object System.Net.WebProxy "10.20.30.55:3128" | |
$login = Read-Host ("Benutzername") | |
$pw = Read-Host ("Kennwort") | |
$cred = New-Object System.Net.NetworkCredential $login, $pw | |
$proxy.Credentials = $cred #(Get-Credential).GetNetworkCredential() |
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 | |
} |
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
#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(); |