I am trying to check the install backup functions and commandline tools are enabled or not.
I've executed Import-ServerManager
and ran the necessary commands to enable backup functions, once done I check them:
$BackupFunction = Get-WindowsFeature | Where-Object {$_.Name -eq "Backup"}
$BackupTools = Get-WindowsFeature | Where-Object {$_.Name -eq "Backup-Tools"}
if($BackupFunction.Installed -and $BackupTools.Installed -eq "True")
The code is returning True
with same PowerShell window.
But if I close and open a new Powershell then checking again it returns
The term 'Get-WindowFeature' is not recognized..