2 # . C:\src\dotfiles\Microsoft.PowerShell_profile.ps1
5 # Get-ChildItem -Path 'C:\Repos' -Filter "*.psd1" -Recurse | ForEach-Object -Process {
6 # $Path = Split-Path -Path $_.Directory -Parent
7 # $env:PSModulePath = $env:PSModulePath + ";$($Path)"
9 # $env:PSModulePath = $env:PSModulePath.Replace("\\ad.uillinois.edu\techsvc\home\$($ENV:USERNAME)\Documents\PowerShell\Modules;",'')
13 Write-Host "***Is Windows***"
18 # Some Paths that are annoying to find/restore if the installer fails
19 $ENV:PATH+=";C:\Program Files\Microsoft VS Code\bin" # One Editor to rule them all
20 $ENV:PATH+=";C:\Program Files\Git\cmd" # Version control is nice.
21 $ENV:PATH+=";C:\ProgramData\chocolatey\bin" # Package management is nice.
22 $ENV:PATH+=";C:\bin\x16emu" # Package management is nice.
23 $ENV:PATH+=";C:\Program Files (x86)\GnuWin32\bin" # GNU Utils - i.e. rm
24 $ENV:PATH+=";C:\PENGUIN" # Flag to ensure my profile kicked in.
25 $ENV:PATH+=";$env:src\x16-demo\tools" # x16 python tools
26 $ENV:PATH+=";$env:src\chart" # command line chart utility edthedev\chart
29 $ENV:PATH+=":$HOME/x16/x16-emulator" # x16 Emulator
30 $ENV:PATH+=":$HOME/src/x16-demo/tools" # x16 python tools
33 # alias renumber $HOME/src/x16-demo/
35 $env:Journal = "~\Journal\2022" # allows cd $env:journal
36 $env:minion = "$env:src\minion"
38 # Import some home grown PowerShell modules, if they are installed.
40 $modPaths = Get-Childitem -ErrorAction Ignore -Path "$env:src\dotfiles\psmodules"
41 $modPaths += Get-Childitem -ErrorAction Ignore -Path "$env:minion\psmodule"
43 # https://github.com/uillinois-community/powershell-scripts
44 $modPaths += Get-Childitem -ErrorAction Ignore -Path "$env:src\powershell-scripts\modules"
46 # Windows Only Modules
48 $modPaths += Get-Childitem -ErrorAction Ignore -Path "$env:src\dotfiles\win_psmodules"
50 if($modPaths.length -eq 0){
51 Write-Host "No modules found."
53 $modPaths | ForEach-Object {
54 $fileName = $_.FullName
55 if($filename -Like "*.psm1") {
56 Import-Module $fileName
57 Write-Host ">> Loaded $fileName"
63 # Linux-like up/down in shell
64 Set-PSReadlineKeyHandler -Key UpArrow -Function HistorySearchBackward
65 Set-PSReadlineKeyHandler -Key DownArrow -Function HistorySearchForward
66 Set-PSReadlineOption -HistorySavePath $env:src\PSHistory.log
68 # Minion alias commands - 'today'
69 # . C:\src\minion\profiles\alias.ps1
70 # . $env:minion\profiles\alias.ps1
71 # Add Minion go executable to path.
72 # . $env:minion\profiles\path.ps1
74 # Write-Host "+ Added minion command to path."
76 # $ENV:PATH+=";$env:minion\go" # Flag to ensure my profile kicked in.
80 New-Alias which get-command
82 # Delay loading PoshGit for speed.
83 function Enable-PoshGit {
84 Import-Module posh-git
86 New-Alias pg Enable-PoshGit
87 Write-Host "+ Type 'pg' to enable PoshGit"
89 function Invoke-X16Emu {
93 x16emu.exe -bas $File -keymap en-us
96 New-Alias x16 Invoke-X16Emu
98 if((Get-Location).Path -eq $HOME){
102 function Get-GitLog() {
106 function Get-GitStatus() {
107 git status -b --short
110 # Tell my scripts which GitHub repositories to look in.
111 $env:GITHUB_USERNAME = 'edthedev'
112 $env:GITHUB_REPOS = @(
113 'techservicesillinois/SecOps-Tools',
114 'techservicesillinois/secdev-job-aids',
115 'techservicesillinois/awscli-login',
116 'techservicesillinois/farmit',
117 'uillinois-community/uillinois-community.github.io',
118 'techservicesillinois/SecOps-Powershell-CSOC',
119 'techservicesillinois/SecOps-Powershell-CISDSC/'
121 $ENV:TS_REPOS = $ENV:GITHUB_REPOS.split(' ') | Where { $_ -like 'techser*' }
124 $ENV:PATH+=";$env:src\todolist" # todo list utility edthedev\todolist
125 $env:todolist = "C:\Users\delaport\Journal\2022"
126 # New-Alias todo todolist
129 New-Alias ol Get-GitLog
130 New-Alias st Get-GitStatus
133 New-Alias dash Show-MyDashboard # from dash.psm1
134 New-Alias agenda Get-JournalAgenda # from minion_go.psm1
136 function Invoke-FixWslVPN {
137 Get-NetAdapter | Where-Object {$_.InterfaceDescription -Match "Cisco AnyConnect Secure Mobility Client Virtual Miniport Adapter for Windows x64"} | Set-NetIPInterface -InterfaceMetric 6000