filmov
tv
Getting started with PowerShell Profiles
Показать описание
In this video, we look at how to solve the most common complaint I get about my videos using a PowerShell Profile. With Profiles, you can have cmdlets like Start-Transcript run everytime you open a new session. Pretty cool stuff that is easy to implement once I show you the basics.
Cmdlets we cover:
* Get_PSReadLineOption
* $profile
* test-path
* New-Item
Video on installing PSReadLine
#Color Function Script
function Show-Colors( ) {
$colors = [Enum]::GetValues( [ConsoleColor] )
$max = ($colors | foreach { "$_ ".Length } | Measure-Object -Maximum).Maximum
foreach( $color in $colors ) {
Write-Host (" {0,2} {1,$max} " -f [int]$color,$color) -NoNewline
Write-Host "$color" -Foreground $color
}
}
#Everything in my profile
Start-Transcript | Out-Null
Set-PSReadlineOption -TokenKind String -ForegroundColor Yellow
IF (([Security.Principal.WindowsPrincipal] ` [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator))
{
}
Else
{
}
cd c:\demo
Cmdlets we cover:
* Get_PSReadLineOption
* $profile
* test-path
* New-Item
Video on installing PSReadLine
#Color Function Script
function Show-Colors( ) {
$colors = [Enum]::GetValues( [ConsoleColor] )
$max = ($colors | foreach { "$_ ".Length } | Measure-Object -Maximum).Maximum
foreach( $color in $colors ) {
Write-Host (" {0,2} {1,$max} " -f [int]$color,$color) -NoNewline
Write-Host "$color" -Foreground $color
}
}
#Everything in my profile
Start-Transcript | Out-Null
Set-PSReadlineOption -TokenKind String -ForegroundColor Yellow
IF (([Security.Principal.WindowsPrincipal] ` [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator))
{
}
Else
{
}
cd c:\demo
Комментарии