This file contains 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
#region Dropbox path | |
$dropboxDBfile = Get-ChildItem -Path $env:USERPROFILE\AppData\Local -Recurse -ErrorAction SilentlyContinue | ? {$_.Name -eq 'host.db'} | |
$base64path = gc $dropboxDBfile.FullName | select -index 1 # -index 1 is the 2nd line in the file | |
$dropboxPath = [System.Text.Encoding]::ASCII.GetString([System.Convert]::FromBase64String($base64path)) # convert from base64 to ascii | |
#endregion |
This file contains 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
#Specify the directory here of the music in which you want to update on a song by song basis | |
$mp3s = Get-ChildItem -Path "C:\Music" -Recurse | ? {$_.Extension -eq '.mp3' -and $_.Directory -match 'AnyDirectoryName'} | |
$taglib = "..\taglib-sharp.dll" | |
[system.reflection.assembly]::loadfile($taglib) | |
Function CheckSong ($song, $against){ | |
$Results = @() | |
$1stResults = @() | |
$2ndResults = @() |
This file contains 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
Import-Module ADSync | |
# Get all ADSync cmdlets | |
Get-Command | Where-Object {$_.ModuleName -eq "ADSync"} | |
#region Force a Directory Sync | |
if((Get-ScheduledTask -TaskName "Azure AD Sync Scheduler").Actions.Execute -match "DirectorySyncClientCmd") | |
{Start-ScheduledTask -TaskName "Azure AD Sync Scheduler"} | |
#endregion | |
This file contains 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
$domain = 'trusbron.com' | |
# Sign into AAD | |
$secpasswd = ConvertTo-SecureString "MyPassword" -AsPlainText -Force | |
$LiveCred = New-Object System.Management.Automation.PSCredential ("admin@tenant.onmicrosoft.com", $secpasswd) | |
Connect-MsolService –Credential $LiveCred | |
########################################################################################## | |
################################## ADFS Cmdlets ################################### | |
########################################################################################## |
This file contains 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
$PreferredSSID = $null # otherwise change this to '$PreferredSSID = 'My SSID'. If $null, it will connect to an available known WiFi network | |
function Get-WifiNetwork { | |
end { | |
netsh wlan show networks mode=bssid | % -process { | |
if ($_ -match '^SSID (\d+) : (.*)$') { | |
$current = @{} | |
$networks += $current | |
$current.Index = $matches[1].trim() | |
$current.SSID = $matches[2].trim() |
This file contains 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
### Variables | |
$dropboxDBfile = Get-ChildItem -Path $env:USERPROFILE\AppData\Local -Recurse -ErrorAction SilentlyContinue | ? {$_.Name -eq 'host.db'} | |
$base64path = gc $dropboxDBfile.FullName | select -index 1 | |
$dropboxPath = [System.Text.Encoding]::ASCII.GetString([System.Convert]::FromBase64String($base64path)) # convert from base64 to ascii | |
$taskName = "Keep_WiFi_Connected" | |
$Path = 'PowerShell.exe' | |
$Arguments = "-ExecutionPolicy Unrestricted -File c:\StartLTE-WiFi.ps1" | |
$Service = new-object -ComObject ("Schedule.Service") |
This file contains 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
# This will create a scheduled task which will run a UserLogonScript for any user that logs on changing the regional settings for the user to Australia. | |
$ShedService = New-Object -comobject 'Schedule.Service' | |
$ShedService.Connect() | |
$Task = $ShedService.NewTask(0) | |
$Task.RegistrationInfo.Description = 'UserLogonScript' | |
$Task.Settings.Enabled = $true | |
$Task.Settings.AllowDemandStart = $true | |
$trigger = $task.triggers.Create(9) |
This file contains 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
# Install the new Azure AD module - as administrator | |
Install-Module AzureAD | |
$user = "powershell" | |
# Connect to the AzureAD | |
Connect-AzureAD -TenantId 'h8c94336-3a68-12d7-h456-736458936j21' | |
# Get & see the Password Policy - it might exist already | |
(Get-AzureADUser -SearchString $user).PasswordPolicies |
This file contains 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
$adminnumbers = @("0402345678", "0401234567") | |
# Get the latest event of the password change | |
$who = (Get-EventLog -LogName Application | where {$_.EventID -eq "656"} | select -First 1).Message | Select-String -Pattern 'CN=(.*?),' -AllMatches | | |
ForEach-Object {$_.Matches} | | |
ForEach-Object {$_.Groups[1].Value} | |
$when = (Get-EventLog -LogName Application | where {$_.EventID -eq "656"} | select -First 1).Message | Select-String -Pattern 'Change\sDate\s:\s(.*?)[\n]' -AllMatches | | |
ForEach-Object {$_.Matches} | | |
ForEach-Object {$_.Groups[1].Value} |
This file contains 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
# Google Blogger necessities - Setup your app here https://console.developers.google.com/ along with OAuth credentials | |
$blogID = "This is the ID of your blog, a series of numbers found on the Blogger site" | |
$app_key = "This is your client ID from your Google app" | |
$app_secret = "This is your client secret from your Google app" | |
$redirect_uri = "https://domain.com" # Can be any HTTPS URL, URL has to be specified when adding the OAuth credentials to your app here https://console.developers.google.com/ | |
# Twitter necessities - http://www.adamtheautomator.com/twitter-module-powershell/ | |
$TwitterApiKey = 'n924hf924f92f0824f' | |
$TwitterApiSecret = 'ng3op8g39ghn39g4wn8gi3p' | |
$TwitterAccessToken = 'n938hgv0985jg0398g059jg03g950jg' |