Powershell `Set-MpPreference` not recognized - powershell

On running Set-MpPreference -DisableScriptScanning 1, I'm getting:
The term 'Set-MpPreference' is not recognized as the name of a cmdlet, function, script file, or
operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ Set-MpPreference -DisableScriptScanning 1
~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Set-MpPreference:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
I've gone through the following threads, but nothing seems to work:
Add-MpPreference is not recognized as a name
Powershell Set-MpPreference -DisableRealtimeMonitoring $true not working
I'm using Powershell v5.1 on Windows 7.
What could the reason be?

Have you tried
Import-Module Defender
I am not sure if the module exists on Windows 7 yet tough...

Use 64bit Powershell:
C:\windows\sysnative\WindowsPowershell\v1.0\powershell.exe

Related

MSI install powershell program but no modules available

I installed AutomatedLab.msi from here - https://github.com/AutomatedLab/AutomatedLab/releases
it installed without any errors but there doesn't appear to be any powershell modules available... or it doesn't seem to know where the modules are? Is there anything else that I can do...
PS C:\Users\Administrator\Downloads> Get-LabAvailableOperatingSystem -Path C:\LabSources
Get-LabAvailableOperatingSystem : The term 'Get-LabAvailableOperatingSystem' is not recognized as the name of a cmdlet, function, script
file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ Get-LabAvailableOperatingSystem -Path C:\LabSources
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Get-LabAvailableOperatingSystem:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Is there some special way I'm supposed to install msi executables? Ive tried 'start-process' I've tried "Install-Module MSI" I can't seem to get anything to work.
Any suggestions?

Get-Command : The term 'Get-AzStorageBlobContent' is not recognized as the name of a cmdlet, function, script file, or operable program

From my question about installing Azure Powershell
I was able to install Azure Powershell 5.1
However when I try to run
Get-Command Get-AzStorageBlobContent
I get
Get-Command : The term 'Get-AzStorageBlobContent' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name,
or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ Get-Command Get-AzStorageBlobContent
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Get-AzStorageBlobContent:String) [Get-Command], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException,Microsoft.PowerShell.Commands.GetCommandCommand
I can see the commands listed in the right panel of ISE and I get intellisence help
The link 135170 takes me here
Get-ExecutionPolicy
returns Restricted
You could run set-executionpolicy remotesigned as administrator to fix the issue.
See: https://www.faqforge.com/windows/windows-powershell-running-scripts-is-disabled-on-this-system/

How do I add exclusions to Microsoft Security Essentials (MSE, Windows 7) through a powershell script?

I need to be able to add antivirus exclusions to MSE on Windows 7 using a powershell (or cmd) script. If I use:
Add-MpPreference -ExclusionPath "C:\Temp"
Add-MpPreference -ExclusionPath "C:\Users\ME\Desktop"
in powershell (which works for Windows 10 Windows Defender) I get this error:
The term 'Add-MpPreference' is not recognized as the name of a cmdlet,
function, script file, or operable program. Check
the spelling of the name, or if a path was included, verify that the path is
correct and try again.
At line:1 char:17
+ Add-MpPreference <<<< -ExclusionPath "C:\Temp"
+ CategoryInfo : ObjectNotFound: (Add-MpPreference:String) [],
CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Any ideas?

The term is not recognized as the name of a cmdlet in powershell

We have recently installed SharePoint 2013 on Windows Server 2012 R2.
When I am trying to run Enable-SPSessionStateService -DefaultProvision using Windows PowerShell then below error is occuring. What am I missing here?? Please help.
PS C:\Users\sysuser> Enable-SPSessionStateService -DefaultProvision
Enable-SPSessionStateService : The term 'Enable-SPSessionStateService' is not recognized as the name of a cmdlet,
function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the
path is correct and try again.
At line:1 char:1
+ Enable-SPSessionStateService -DefaultProvision
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Enable-SPSessionStateService:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException

Pipe more doesn't seem to be working in Powershell v4.0

I'm trying to run a command that displays several screens of text and I'm trying to use the more command, but it doesn't seem to be working.
When I try to use a command like this:
Get-Help Get-Alias -full | more
I get an error that says this:
more.com : The term 'more.com' is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:14 char:14
+ $input | more.com
+ ~~~~~~~~
+ CategoryInfo : ObjectNotFound: (more.com:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Anyone have any ideas as to why?
Turns out that powershell.exe was not in the path.