Hello,
I installed Visual Studio Code, Powershell 7.3.7 and within VSCode the PowerShell plugin. Then I also installed the feature “Windows-Server-Backup”.
When I tried to create a new WBPolicy object with the cmdlet “New-WBPolicy” I got the error:
The term ‘New-WBPolicy’ is not recognized as a name of a cmdlet, function, script file, or executable program.
The same happens with Get-WBDisk.
I verified the installation of the feature: “(Get-WindowsFeature).Where({$_.name -eq ‘Windows-Server-Backup’}).installed”
Does anyone have an idea what I am doing wrong here.
I tested it in a Windows PowerShell session and I cannot reproduce the issue you have. Even without starting the PowerShell console new I could run immediately Get-WBDisk and got an output.
Have you tried running the commands in a Windows PowerShell session?
Running PowerShell 7.3.7 console I experience the same behavior than running it within VS-Code (I verified that the feature Windows-Server-Backup is installed).
Until i have a solution i will use Windows PowerShell 5.1. With Windows PowerShell 5 I have no problems with the Windows-Server-Backup commands.
You can switch between a console using version 7 and version 5.1 in VSCode.
Does version 7 see the module?
Get-Module -ListAvailable WindowsServerBackup
If “yes”, can you import it manually?
Import-Module -Name WindowsServerBackup
Regardless of all that - until you don’t need a particular feature only available in version 7 there’s no need to migrate from version 5.1 to 7.x. Windows PowerShell is still fully supported and will probably be for a very long time.
I’ll do switching in VSCode between V5 and V7 later (I have to discover how to do that).
Yes, but unlike version 5.1, I see that only the “Backup-ACL” and “Restore-ACL” commands are exported. And exactly these two commands I can use in version 7.
Yes.
Yes, for the moment probably the only alternative for me. My reason for switching to version 7 was the same PowerShell environment on Linux and Windows.