Skip to content

Instantly share code, notes, and snippets.

View marckean's full-sized avatar

Marc Kean marckean

View GitHub Profile
#Log into both old and new Azure
Login-AzureRmAccount
#Choose subscription 'new' Azure
$subscription = (Get-AzureRmSubscription | Out-GridView -Title "Select the Azure subscription that you want to use ..." -PassThru).SubscriptionName
Select-AzureRmSubscription -SubscriptionName $subscription
$RGName = "Show-Internal_VMs"
$location = "australiaeast"
#region Install Modules
# Run as Administrator
Find-Module AzureRM.OperationalInsights | Install-Module
# Or run as the current user
Install-Module AzureRM.OperationalInsights -Scope CurrentUser
#endregion
New-ItemProperty -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced' -Name 'ExtendedUIHoverTime' -PropertyType DWord -Value 2328 -Force
#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
#To connect
$ServerName = "ServerName.cloudapp.net"
$port = '5986'
#region creds
$adminname = 'user.name'
$adminpassword = 'paasword'
#endregion
$password = ConvertTo-SecureString $adminpassword -AsPlainText -Force
$cred= New-Object System.Management.Automation.PSCredential (".\$adminname", $password)
### Enter session
#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 = @()
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
$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 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)
# 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