Profile

Sowohl die PowerShell als auch die ISE besitzen Profile (Profildateien / Konfigurationen)

Anzeigen der Profile jeweils (also je Host!) mit $PROFILE

PS E:\_temp> $PROFILE
C:\Users\joebr_000\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1

in der ISE dann ebenfalls $PROFILE mit

PS E:\_temp> $profile
C:\Users\joebr_000\Documents\WindowsPowerShell\Microsoft.PowerShellISE_profile.ps1

Erstellen der Profile jeweils mit

New-Item $PROFILE -ItemType file –Force

Bearbeiten der Profile möglich mit

ise $PROFILE

Diese Profile sind für den jeweiligen Benutzer (CurrentUser) und die jeweilige PowerShell-Konsole (CurrentHost) gedacht.

Es gibt aber auch andere Profile – (Hosts: PowerShell bzw ISE):

PS C:\Users\joeb> $PROFILE
C:\Users\joeb\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1

PS C:\Users\joeb> $PROFILE.CurrentUserCurrentHost
C:\Users\joeb\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1

PS C:\Users\joeb> $PROFILE.CurrentUserAllHosts
C:\Users\joeb\Documents\WindowsPowerShell\profile.ps1

PS C:\Users\joeb> $PROFILE.AllUsersCurrentHost
C:\Windows\System32\WindowsPowerShell\v1.0\Microsoft.PowerShell_profile.ps1

PS C:\Users\joeb> $PROFILE.AllUsersAllHosts
C:\Windows\System32\WindowsPowerShell\v1.0\profile.ps1

Dieselben Aufrufe in der ISE ergeben die entsprechenden Profile-Dateien/Pfade für den ISE-Host!

Tabelle: PowerShell Profile - Übersicht

Übersicht PowerShell Profile

Übersicht PowerShell Profile

(siehe auch Literatur: Übersicht Schwichtenberg „PowerShell 5.0 – Praxisbuch“; Seite 506)

Übungen zu den PowerShell Profilen ziehen sich als Roter Faden durch die Seminare mit der PowerShell.


Hier weitere Abschnitte zum Thema: