Skip to content

Instantly share code, notes, and snippets.

View nonprofittechy's full-sized avatar

Quinten Steenhuis nonprofittechy

View GitHub Profile
@nonprofittechy
nonprofittechy / disconnect-wsession.psm1
Created September 19, 2016 20:47
disconnect-wsession.psm1
<#
Disconnect-wsession: forefully logoff a user's session using the qwinsta.exe / rwinsta.exe commands
Purpose: prevent automatic account lockout
Defaults to logging off the current user's session on the remote computer.
#>
function disconnect-wsession ($computer, $username) {
$username = if ($username) {$username} else {$env:username}
if (test-connection $computer -count 1) {
@nonprofittechy
nonprofittechy / gist:1f8123f79166241575fa
Last active August 29, 2015 14:02
Bulk-Import photos into AD
$ipath = "C:\PATH_TO_THUMBNAILS"
$images = gci -Path $ipath
$jpgBytes = $null
foreach ($image in $images) {
$jpgBytes = $null
$jpgBytes = [byte[]]$jpg = Get-Content ($image.fullName) -encoding byte