Create AD users from a CSV-file

Here is an example of a script to create AD users from a CSV-file and assign a temoporary password.

	[parameter(Mandatory = $true)]

$OU = "OU=Users,DC=PSLABB,Dc=local"

$users = Import-Csv -Path $infile

foreach ($user in $users)
	$rand = Get-Random -Minimum 1000 -Maximum 9999
	$pwd = "Temp$rand"
	$name = "$($user.givenname)" + " " + $($user.surname)
	New-ADUser -Name $name -GivenName $user.Givenname -Surname $user.Surname -SamAccountName $user.username -user $user.username -Description "Tempuser" -path $ou -enabled $true -AccountPassword (convertTo-securestring -AsPlainText "Temp$rand" -Force)
	$details = @{
		'Name'= $name;
		'username'  = $($user.username);
		'Password'     = $pwd
	$results = New-Object PSObject -Property $details
	$results | Export-Csv -Path $output -NoTypeInformation -Append

Upgrade firmware on HP Procurve switches with TFTP

Short instruction for firmware upgrade over TFTP and CLI.

2017-06-12 07_33_52-Underhåll - Internet Explorer

Type show version to determine what version your switch is running on.

2017-06-12 07_25_41-dahladm@csesv-rancid_ ~

Use command copy tftp flash hostname filename primary to download firmware from a TFTP server. Change hostname and filname to fit your enironment.

2017-06-12 07_27_37-COM1 - PuTTY

Reload the switch and verify new firmware version.

2017-06-12 07_52_20-RhinoTM (IND) _ Dymo




OP5 plugin example in powershell

If you want to monitor your windows server uptime in OP5. Run from NSClient++ on all hosts you want to monitor uptime on.

	[parameter(Mandatory = $true)]
	[parameter(Mandatory = $true)]
function Get-Uptime
	$os = Get-WmiObject win32_operatingsystem
	$uptime = (Get-Date) - ($os.ConvertToDateTime($os.lastbootuptime))
	return $Uptime
$os = Get-CimInstance Win32_OperatingSystem | Select-Object  Caption | ForEach{ $_.Caption }
$uptime = Get-Uptime

if ( $uptime.Days -gt $c)
	Write-Host Write-Host "CRITICAL Uptime:" $Uptime.Days "days"
	exit 2

if ($uptime.Days -gt $w)
	Write-Host Write-Host "WARNING Uptime:" $Uptime.Days "days"
	exit 1

if ($uptime.Days -lt $w)
	Write-Host "OK" $Uptime.Days "days uptime"
	Write-Host "OS: $os"
	exit 0