If you use the default "old" PowerShell 5, check whether the profile.ps1
in C:\Users\USER\Documents\WindowsPowerShell
contains:
#region conda initialize
# !! Contents within this block are managed by 'conda init' !!
(& "C:\Users\USER\anaconda3\Scripts\conda.exe" "shell.powershell" "hook") | Out-String | Invoke-Expression
#endregion

If you have a message that the profile.ps1 cannot be executed, solve that problem with set-executionpolicy remotesigned
(but: insecure, thus, not recommended!), see:
Windows PowerShell
Copyright (C) Microsoft Corporation. Alle Rechte vorbehalten.
Installieren Sie die neueste PowerShell für neue Funktionen und Verbesserungen! https://aka.ms/PSWindows
. : Die Datei "C:\Users\USER\Documents\WindowsPowerShell\profile.ps1" kann nicht geladen werden, da die Ausführung
von Skripts auf diesem System deaktiviert ist. Weitere Informationen finden Sie unter "about_Execution_Policies"
(https:/go.microsoft.com/fwlink/?LinkID=135170).
In Zeile:1 Zeichen:3
+ . 'C:\Users\USER\Documents\WindowsPowerShell\profile.ps1'
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : Sicherheitsfehler: (:) [], PSSecurityException
+ FullyQualifiedErrorId : UnauthorizedAccess
PS C:\WINDOWS\system32> set-executionpolicy remotesigned
Ausführungsrichtlinie ändern
Die Ausführungsrichtlinie trägt zum Schutz vor nicht vertrauenswürdigen Skripts bei. Wenn Sie die Ausführungsrichtlinie
ändern, sind Sie möglicherweise den im Hilfethema "about_Execution_Policies" unter
"https:/go.microsoft.com/fwlink/?LinkID=135170" beschriebenen Sicherheitsrisiken ausgesetzt. Möchten Sie die
Ausführungsrichtlinie ändern?
[J] Ja [A] Ja, alle [N] Nein [K] Nein, keine [H] Anhalten [?] Hilfe (Standard ist "N"): j

After entering j
, restart PowerShell. You will see the profile.ps1
in action:
Windows PowerShell
Copyright (C) Microsoft Corporation. Alle Rechte vorbehalten.
Installieren Sie die neueste PowerShell für neue Funktionen und Verbesserungen! https://aka.ms/PSWindows
Das Laden von persönlichen und Systemprofilen dauerte 1400 ms.
(base) PS C:\Users\USER>

In short, try to make it possible that the "profile.ps1" gets loaded. In my case, I did not need this trick anymore since I installed PowerShell 7 which is allowed to load the profile.ps1
by default. You might also just open the old PowerShell 5 from Visual Studio Code instead and change the settings so that conda init
runs at the start, see How to add anaconda powershell to vscode?.
Its profile.ps1
had the same content, you find it in C:\Users\USER\Documents\PowerShell\profile.ps1
.
When I start PowerShell 7, conda init
runs automatically, no insecure tricks needed. Therefore, just install PowerShell 7 in parallel (do not remove the old PowerShell 5!) and use the new version instead.