Getting started with PowerShell Profiles

preview_player
Показать описание
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

Рекомендации по теме
Комментарии
Автор

5 years later. Still relevant and awesome. Thanks Shane!

natestrings
Автор

Your videos are definitely the most digestible for learning some of the fundamentals necessary to think in the context of code. A lot of the courses on YouTube tend to easily overlook that context of thought comes before content of thought.

academyministorage
Автор

I love your PS lessons, very helpful. I come from Taiwan, Thanks Shane

scottlee
Автор

Your video just came in on time. This helps me a lot. It is funny, both my Online Instructor and an over $150 textbook have poor lessons about a PowerShell Profile. Thanks for making this video.

jas
Автор

Ahhh dubstep intros from 2017, One thing I do not miss. love the vid though!

void
Автор

Thanks Shane, This is great stuff!  I would love to have a full transcript.

MatrixTek
Автор

I have watched all your videos and they helped me a lot!! Thanks

BezKomentare
Автор

This video feels 20 years old with that style of speaking and editing, even though it is only 5.

YahyaArbab
Автор

Thanks Shane, are you able to guide how to import functions to the profile script.

rashmitapriyadarsini
Автор

I love your PS videos, keep them coming👌

NancyRileyNuniverse
Автор

good lesson but I got into security execution policies when I (re)open PowerShell, the profile file fails to load

SylvStone
Автор

Keen to set up a profile, but (on work PC HP8560p Windows 10 PowerShell ISE),
<New-Item -path $PROFILE -ItemType File>
fails, with error message
New-Item : Could not find a part of the path

At line:1 char:1
Any ideas?

carrt
Автор

Great content. My PowerShell profiles on my laptop and desktop both point to one .ps1 file that's stored on OneDrive and I'd like to disable this so profiles on my laptop and desktop are separate. How do I do this?

dazecm
Автор

Nice, but as I'm Iron Man 2.0, I need some cool ASCII art showing when opening the terminal. I made a nice batch file and would like to know

-where do I have to store "terminal.bat"
-how do I include the bat in $PROFILE

erikschiegg
Автор

How about something like a roaming profile for PowerShell, that follows you around from machine to machine? Can you point the profile to a NAS location? (Hope you didn't mention that and I missed it).

bobdillon
Автор

Hi just started using your videos to learn PowerShell. Which are great bye the way 😁.
I do everything the same but when I get to 6:34 In the vid I get error message which is too long to write on here but goes
+CategoryInfo:Invalid argument.
+fullyquailified error id:positional parameter not found.
Any help would b appreciate.
Thx

jaque
Автор

How did you get the "Get_PSReadLineOption"? I am seeing "ObjectNotFound". I am using Powershell 2.0.

arig
Автор

could you please tell me from where you copied code or please paste here for poiwershell profile so that i could use

manojkumar-iuen
Автор

Hi shane young i am looking on trainig video from your end
On PS special characters like $ is used for Variable declaration like that
{}, |, %, ., ::, .., !, ?, '() when and how to use this special characters in PS Scripting

kimran
Автор

Bummer! PSReadLineOption is completely different in Win10.

RufusVidS