Skip to content

Instantly share code, notes, and snippets.

View Windos's full-sized avatar

Josh King Windos

View GitHub Profile
$path = 'HKCU:\Software\Microsoft\Internet Explorer\Main\'
#First page
$name = 'start page'
$value = 'https://www.google.com/?gws_rd=ssl'
Set-Itemproperty -Path $path -Name $name -Value $value
#Additional pages
$name = 'Secondary Start Pages'
$value = @('https://secondpage.com/', 'https://thirdpage.co.nz')
#Requires -Version 3.0
#Requires -Modules MSOnline, SkypeOnlineConnector, Microsoft.Online.SharePoint.PowerShell
<#
Required downloads
Microsoft Azure Active Directory Module for Windows PowerShell
32-bit: http://aka.ms/fohrds
64-bit: http://aka.ms/siqtee
Skype for Business Online Connector: http://aka.ms/x3kyib
#Requires -Modules PoshRSJob, PoshPctBar, ActiveDirectory
function New-StorageReport {
<#
.SYNOPSIS
Creates a new Server Storage Report.
.DESCRIPTION
The New-StorageReport function creates a new Storage Report of local disks on all servers in a specific Organizational Unit in Active Directory.
.INPUTS
None.
.OUTPUTS
@Windos
Windos / PasswordReminder.ps1
Created January 25, 2018 10:16
Pester people with toasts when their password is close to expiring
$JobBlock = {
$ExpiryTime = Get-ADUser $env:USERNAME -Properties 'msDS-UserPasswordExpiryTimeComputed'
$Expiry = [datetime]::FromFileTime($ExpiryTime.'msDS-UserPasswordExpiryTimeComputed')
$TimeToGo = New-TimeSpan -Start (Get-Date) -End $Expiry
if ($TimeToGo -le 3) {
if ($TimeToGo.Days -gt 0) {
$Count = $TimeToGo.Days
$Unit = 'Days'
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" UpgradeCode="__GUID1__" Version="1.0.0.0" Language="1033" Name="__NAME__" Manufacturer="__MANUFACTURER__">
<Package InstallerVersion="300" Compressed="yes"/>
<Media Id="1" Cabinet="__NAME__.cab" EmbedCab="yes" />
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="APPLICATIONROOTDIRECTORY" Name="__NAME__"/>
</Directory>
@Windos
Windos / TonerLevels.ps1
Created April 28, 2018 23:12
Toast with multiple progress bars, showing toner levels
# Unfortunatly, it's not currently possible to give New-BurntToastNotification multiple progressbars... so diving into all of these other functions are needed.
# I'll fix this in the next version of BurntToast.
$Text1 = New-BTText -Content 'Printer01 Toner Levels'
$BlackProgressBar = New-BTProgressBar -Status 'Black' -Value 0.3
$YellowProgressBar = New-BTProgressBar -Status 'Yellow' -Value 0.9
$MagentaProgressBar = New-BTProgressBar -Status 'Magenta' -Value 0.75
$CyanProgressBar = New-BTProgressBar -Status 'Cyan' -Value 0.1
@Windos
Windos / PS-ScheduledJob-FullExePath.ps1
Created June 19, 2018 23:47
Changing PowerShell.exe to full path for Windows PowerShell scheduled jobs
$Option = New-ScheduledJobOption -RunElevated -RequireNetwork
Register-ScheduledJob -ScriptBlock {Add-Content -Path C:\temp\joblog.txt -Value (Get-Date)} -Name 'Test Job' -ScheduledJobOption $Option -RunNow
$CurrentAction = (Get-ScheduledTask -TaskName 'Test Job').actions
$Params = @{
Id = $CurrentAction.Id
Argument = $CurrentAction.Arguments
Execute = 'C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe'
}
### GetMailAutoReply.ps1
<#
.SYNOPSIS
Gets a users current auto reply message and state.
#>
param
(
[Parameter(Mandatory = $true,
function Get-OrphanedMailbox {
$ExSplat = @{
ConfigurationName = 'Microsoft.Exchange'
ConnectionUri = 'http://exchange.example.com/powershell'
Authentication = 'Kerberos'
}
$ExSession = New-PSSession @ExSplat
Import-PSSession -Session $ExSession *>$null
@Windos
Windos / RemoteToast.xml
Created January 10, 2019 05:18
XML dump for inclusion in blog post
<?xml version="1.0" encoding="utf-8"?><toast><visual><binding template="ToastGeneric"><text>No Time For Questions</text><text>All servers are being shut down in __WARNTIME__, save your work!</text></binding></visual><audio src="ms-winsoundevent:Notification.Looping.Alarm" /></toast>