-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMicrosoft.PowerShell_profile.ps1
67 lines (47 loc) · 1.82 KB
/
Microsoft.PowerShell_profile.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
$host.ui.RawUI.WindowTitle = "Beau is #1"
##[console]::ForegroundColor = "Green"
##[console]::BackgroundColor = "black"
##Set-ItemProperty -Path HKCU:\console -Name WindowAlpha -Value 205
Set-PSReadlineKeyHandler -Key Tab -Function MenuComplete
set-location c:\PowerShell
Write-Output "Please don't tap on the glass. It scares the IT guys"
function Get-Excuse {
If ( !( Get-Variable -Scope Global -Name Excuses -ErrorAction SilentlyContinue ) ) {
$Global:Excuses = (Invoke-WebRequest http://pages.cs.wisc.edu/~ballard/bofh/excuses).Content.Split([Environment]::NewLine)
}
Get-Random $Global:Excuses
}
function o365 {
$credential = Get-Credential
Import-Module MsOnline
Connect-MsolService -Credential $credential
$exchangeSession = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri "https://outlook.office365.com/powershell-liveid/" -Credential $credential -Authentication "Basic" -AllowRedirection
Import-PSSession $exchangeSession -DisableNameChecking
}
function o365d {
Remove-PSSession $exchangeSession
}
##function sync {
##invoke-command -ComputerName awcc-ut1-us -scriptblock {Start-ADSyncSyncCycle -PolicyType Delta}
##}
function sync {
Write-Host "Initializing Azure AD Delta Sync..." -ForegroundColor Yellow
invoke-command -ComputerName awcc-ut1-us -scriptblock {Start-ADSyncSyncCycle -PolicyType Delta}
#Wait 10 seconds for the sync connector to wake up.
Start-Sleep -Seconds 10
#Display a progress indicator and hold up the rest of the script while the sync completes.
While(invoke-command -ComputerName awcc-ut1-us -scriptblock {Get-ADSyncConnectorRunStatus}){
Write-Host "." -NoNewline
Start-Sleep -Seconds 10
}
Write-Host " | Complete!" -ForegroundColor Green
}
function newuser {
c:\users\beau\NewADUser-v15.ps1
}
function food {
c:\users\beau\food.ps1
}
function 2fa {
c:\PowerShell\WhoHas2fa.ps1
}