Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

the-ultimate-powershell-experience/ #202

Open
utterances-bot opened this issue May 4, 2024 · 10 comments
Open

the-ultimate-powershell-experience/ #202

utterances-bot opened this issue May 4, 2024 · 10 comments

Comments

@utterances-bot
Copy link

The Ultimate Powershell Experience

Having Fun with Technology

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

Copy link

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

Copy link

tommyq86 commented May 5, 2024

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 :)

Copy link

SMJ804 commented May 7, 2024

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

Copy link

nairbd commented May 7, 2024

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?

Copy link

SMJ804 commented May 8, 2024

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

Copy link

SMJ804 commented May 8, 2024

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
Copy link

nairbd commented May 8, 2024

Thank you @SMJ804 your solution worked for me

Copy link

tgaguy commented Sep 16, 2024

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

Copy link

The command irm “https://github.com/ChrisTitusTech/powershell-profile/raw/main/setup.ps1” | iex generated the following output in powershell:
Invoke-Expression: Missing closing '}' in statement block or type definition.
I'm using PowerShell 7.4.6

Copy link

I have tried a lot but whenever I made changes, I am stuck with this error.
Invoke-Expression: C:\Users\Haseeb Ul Hassan\Documents\PowerShell\profile.ps1:498
Line |
498 | Invoke-Expression $existingTheme
| ~~~~~~~~~~~~~~
| Cannot convert 'System.Object[]' to the type 'System.String' required by parameter 'Command'. Specified method
| is not supported.
Use 'Show-Help' to display help
Profile is up to date.
Checking for PowerShell updates...
Your PowerShell is up to date.
Invoke-Expression: C:\Users\Haseeb Ul Hassan\Documents\PowerShell\Microsoft.PowerShell_profile.ps1:503
Line |
503 | Invoke-Expression $existingTheme
| ~~~~~~~~~~~~~~
| Cannot convert 'System.Object[]' to the type 'System.String' required by parameter 'Command'. Specified method
| is not supported.
Use 'Show-Help' to display help
When I removed the microsoft_profile from the directory then the following error started occuring.
Get-FileHash: C:\Users\Haseeb Ul Hassan\Documents\PowerShell\profile.ps1:58
Line |
58 | $oldhash = Get-FileHash $PROFILE
| ~~~~~~~~~~~~~~~~~~~~~
| Cannot find path 'C:\Users\Haseeb Ul Hassan\Documents\PowerShell\Microsoft.PowerShell_profile.ps1' because it
| does not exist.
Profile has been updated. Please restart your shell to reflect changes
Checking for PowerShell updates...
Your PowerShell is up to date.
Invoke-Expression: C:\Users\Haseeb Ul Hassan\Documents\PowerShell\profile.ps1:503
Line |
503 | Invoke-Expression $existingTheme
| ~~~~~~~~~~~~~~
| Cannot convert 'System.Object[]' to the type 'System.String' required by parameter 'Command'. Specified method
| is not supported.
Use 'Show-Help' to display help
Profile is up to date.
Checking for PowerShell updates...
Your PowerShell is up to date.
Invoke-Expression: C:\Users\Haseeb Ul Hassan\Documents\PowerShell\Microsoft.PowerShell_profile.ps1:503
Line |
503 | Invoke-Expression $existingTheme
| ~~~~~~~~~~~~~~
| Cannot convert 'System.Object[]' to the type 'System.String' required by parameter 'Command'. Specified method
| is not supported.
Use 'Show-Help' to display help

I am using 7.4.6 powershell. I am also using latest profile from github.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants