ChrisTitusTech / website

My HUGO Website that I use for Videos, Blogs, and Redirects
88 stars 45 forks source link

the-ultimate-powershell-experience/ #202

Open utterances-bot opened 6 months ago

utterances-bot commented 6 months ago

The Ultimate Powershell Experience

Having Fun with Technology

https://christitus.com/the-ultimate-powershell-experience/

akvariefisk commented 6 months ago

I always get at launch of my terminal: Skipping PowerShell update check due to GitHub.com not responding within 1 second.

tommyq86 commented 6 months ago

Very nice. Would be fine to have a section for custom functions which wouldn't be lost during the update or at least some way to load some custom.ps1 :)

SMJ804 commented 6 months ago

@akvariefisk You must be using powershell 5.1 swithc to powershell 7.4 and it will be fixed. I had the same issue

nairbd commented 6 months ago

Every time I try to change my oh-my-posh profile, the Update-Profile function overwrites the change and reverts back to the original. Any way to change this?

SMJ804 commented 6 months ago

Okay, so for me the script was saved on C:\Users\[USER NAME]\OneDrive\Documents\PowerShell\Microsoft.PowerShell_profile.ps1 . if you cannot find the powershell script just search it on Everything. There is a line at the bottom that says

## Final Line to set prompt oh-my-posh init pwsh --config https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/cobalt2.omp.json | Invoke-Expression

change that to your theme, for me changed the word cobalt2 to amro and it worked

After changing

## Final Line to set prompt oh-my-posh init pwsh --config https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/amro.omp.json | Invoke-Expression

Hope this works

SMJ804 commented 6 months ago

UPDATE

The profile updating function in the script resets the changes we made in the script so I again edited it to stop checking for profile updates

CAUTION :I am not a programmer and I am no expert in this

What I ended up doing was to put a return statement under Update-Profile function which skips the whole profile update checking. It worked for me and I think it is a solution till Chris comes and fixes this bug.

# Check for Profile Updates
function Update-Profile {
    Write-Host "Skipping Update to Preserve Theme"
    return
    if (-not $global:canConnectToGitHub) {
        Write-Host "Skipping profile update check due to GitHub.com not responding within 1 second." -ForegroundColor Yellow
        return
    }
nairbd commented 6 months ago

Thank you @SMJ804 your solution worked for me

tgaguy commented 2 months ago

PowerShell 7.4.1

A new PowerShell stable release is available: v7.4.5 Upgrade now, or check out the release page at: https://aka.ms/PowerShell-Release?tag=v7.4.5

Warning: PowerShell detected that you might be using a screen reader and has disabled PSReadLine for compatibility purposes. If you want to re-enable it, run 'Import-Module PSReadLine'.

Checking for PowerShell updates... Updating PowerShell... No installed package found matching input criteria. PowerShell has been updated. Please restart your shell to reflect changes Use 'Show-Help' to display help Loading personal and system profiles took 5639ms.

Restarting Powershell 7 does not load 7.4.5., keeps reopenign 7.4.1