ChrisTitusTech / website

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

the-ultimate-powershell-experience/ #202

Open utterances-bot opened 3 months ago

utterances-bot commented 3 months ago

The Ultimate Powershell Experience

Having Fun with Technology

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

akvariefisk commented 3 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 3 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 3 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 3 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 3 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 3 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 3 months ago

Thank you @SMJ804 your solution worked for me