Skip to content

Instantly share code, notes, and snippets.

@mortenya
mortenya / Set-ProxyAddresses.ps1
Created September 14, 2016 21:04
We didn't have an Exchange server on site with everyone's mailbox, and this was a requirement for migrating from GroupWise to Exchange Online.
$users = get-aduser -Filter * -Properties proxyAddresses,EmailAddress
foreach ($u in $users) {
if (!($u.proxyAddresses -contains "SMTP:$($u.EmailAddress)")) {
$u.proxyAddresses.Add("SMTP:$($u.EmailAddress)")
Set-ADUser -Identity $u.SamAccountName -Add @{ 'proxyAddresses' = $($u.proxyAddresses) }
}
else {
Write-Host "$($u.name) already had the correct proxyaddresses"
}
@mortenya
mortenya / Parse-GWCheckLog.ps1
Last active September 15, 2016 20:37
These are some scripts I've used to parse unstructured output from GroupWise to get useful info. Parse-GWCheckLog.ps1 was the first one I wrote, and it might be a little fat. A good learning point though.
Set-Location C:\GWCheck
Get-ChildItem . | % {
Get-Content $_.FullName -PipelineVariable log | % {
if ($log -match "\S*Checking user =*\S.([^\s]+)|[\s]+(\d+).\S*kbytes*\S")
{
$matches[0] | Out-File -Append .\gwcheck.txt #"" | select @{n='User';e={$matches[1]}},@{n='Size';e={$matches[2]}}
}
}
}
@mortenya
mortenya / Remove-GroupWiseClient.ps1
Created September 21, 2016 20:40
There was no universal uninstaller for the GroupWise client that functioned the way we needed, so this script will simply find the installation in the registry and run the uninstall via MSIEXEC.
if (Test-Path HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall) {
$gwreg = Get-ChildItem HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall | foreach {
Get-ItemProperty $_.pspath | where {
$_.DisplayName -like '*GroupWise*'
}
}
}
else {
$gwreg = Get-ChildItem HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall | foreach {
Get-ItemProperty $_.pspath | where {
<#
.SYNOPSIS
Resize photos to a specified size, 648 by default
Rename them and place them in a 'resized' folder
.EXAMPLE
Get-ChildItem -Path C:\Picures | Resize-ThumbnailPhoto
#>
Function Resize-ThumbnailPhoto
##########
# Win10 Initial Setup Script
# Author: Disassembler <disassembler@dasm.cz>
# Version: 1.4, 2016-01-16
# http://pastebin.com/gQxCUkLP
# Modified: Casey Gray, 2016-04-27
##########
# Script Execution must be enabled
# Ask for elevated permissions if required