Skip to content

Instantly share code, notes, and snippets.

View contactbrenton's full-sized avatar
Found on Linkedin "Brenton Johnson"

Brenton Johnson contactbrenton

Found on Linkedin "Brenton Johnson"
  • Uptake Digital
  • Australia
View GitHub Profile
$ApplicationId = 'YourApplicationID'
$ApplicationSecret = 'YourApplicationSecret' | Convertto-SecureString -AsPlainText -Force
$TenantID = 'YourTenantID'
$ExchangeRefreshToken = 'YourExchangeToken'
$RefreshToken = 'YourRefreshToken'
$UPN = "UPN-Used-To-Generate-Token"
##############################
$credential = New-Object System.Management.Automation.PSCredential($ApplicationId, $ApplicationSecret)
$aadGraphToken = New-PartnerAccessToken -ApplicationId $ApplicationId -Credential $credential -RefreshToken $refreshToken -Scopes 'https://graph.windows.net/.default' -ServicePrincipal -Tenant $tenantID
REG DELETE HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU /va /f
get-mailbox | Select DisplayName,UserPrincipalName,HasPicture | Export-Csv C:\photostatus.csv -nti
@contactbrenton
contactbrenton / TWINUI.ps1
Created April 1, 2020 11:36
fixes Twinui problem on Windows 10
Get-AppXPackage | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"}
@contactbrenton
contactbrenton / update-all-modules-ps.ps1
Last active February 1, 2020 11:36
Automatically Updating Modules
Get-InstalledModule | Update-Module
$Report = @()
$i = 0
$Accounts = (Get-MsolUser -All | ? {$_.StrongAuthenticationMethods -ne $Null} | Sort DisplayName)
ForEach ($Account in $Accounts) {
Write-Host "Processing" $Account.DisplayName
$i++
$Methods = $Account | Select -ExpandProperty StrongAuthenticationMethods
$MFA = $Account | Select -ExpandProperty StrongAuthenticationUserDetails
$State = $Account | Select -ExpandProperty StrongAuthenticationRequirements
$Methods | ForEach { If ($_.IsDefault -eq $True) {$Method = $_.MethodType}}