Powershell: can't access MSMQ Cmdlets - powershell

I'd like to use the Message Queueing (MSMQ) Cmdlets Message Queueing (MSMQ) Cmdlets but they all show as unavailable:
PS C:\users\admin\Desktop> Get-MsmqQueue
Get-MsmqQueue : The term 'Get-MsmqQueue' 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-MsmqQueue
+ ~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Get-MsmqQueue:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
I have Windows 8.1 and PowerShell 4 running as administrator
PS C:\users\admin\Desktop> $PSVersionTable.PSVersion
Major Minor Build Revision
----- ----- ----- --------
4 0 -1 -1

According to OP's comment, MSMQ features were not installed :
I just assumed the machine I was on had MSMQ already but it turned out it didn't.
See this question for instructions on how to install them with PowerShell

Related

Powershell `Set-MpPreference` not recognized

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

PowerShell does not recognize the command Resolve-DnsName

Error on power shell script,
Import-Module DnsClient
Import-Module : The specified module 'DnsClient' was not loaded because no
valid module file was found in any module directory.
At line:1 char:1
+ Import-Module DnsClient
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ResourceUnavailable: (DnsClient:String) [Import-Module], FileNotFoundException
+ FullyQualifiedErrorId : Modules_ModuleNotFound,Microsoft.PowerShell.Commands.ImportModuleCommand
Resolve-DnsName
Resolve-DnsName : The term 'Resolve-DnsName' 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
+ Resolve-DnsName
+ ~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Resolve-DnsName:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
PS C:\Users\aquib> $PSVersionTable.PSVersion
Major Minor Build Revision
----- ----- ----- --------
2 0 -1 -1
Resolve-DnsName is one of the commands added in Windows 8/Windows 2012 and later. By design, it is not available on versions of Windows prior to that regardless of which version of PowerShell you use. The command is unavailable on Windows 7 and Windows 2008 R2 and earlier. Most sources I've read say that the underlying WinAPI functions that the command depends upon were added in Windows 8/2012.
I would recommend using [System.Net.Dns]::GetHostEntry($HostnameOrIP) or one of the other non-obsolete static methods in that class. However, that only works for A, AAAA, and PTR records, and there isn't a class in the .Net Framework CLR for generic DNS requests. You'd have to roll your own or use a third-party library like ARSoft.Tools.Net.

'New-SelfSignedCertificate' is not recognised as the name of a cmdlet [duplicate]

On a Windows 7 Professional system, it seems not possible to run New-SelfSignedCertificate. I could on a Windows 10 system.
Yes, the shell was started with "Run As Administrator."
PS C:\> new-selfsignedcertificate
new-selfsignedcertificate : The term 'new-selfsignedcertificate' 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
+ new-selfsignedcertificate
+ ~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (new-selfsignedcertificate:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
PS C:\> $PSVersionTable.PSVersion
Major Minor Build Revision
----- ----- ----- --------
5 0 10586 117
As stated in the comments above, this isn't available in Windows 7.
However, if you're looking for something with a similar API and capability, then I have used & can recommend this from Microsoft Script Centre:
https://gallery.technet.microsoft.com/scriptcenter/self-signed-certificate-5920a7c6
Have to install AzureRM module to use azure commands through powershell. You can use below command to do it.
Install-Module -Name AzureRM -AllowClobber

The term 'Set-AzureKeyVaultKeyAttributes' is not recognized as the name of a cmdlet,

On my Windows 10 I've Powershell 5.0 installed. But when I run the following command on it, I get the above error.
PS command:
Set-AzureKeyVaultKeyAttributes -Name Key2 -VaultName KayVault-abctest -Enable $false
Error
Set-AzureKeyVaultKeyAttributes : The term 'Set-AzureKeyVaultKeyAttributes' 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-AzureKeyVaultKeyAttributes -Name Key2 -VaultName KayVault-abctest ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Set-AzureKeyVaultKeyAttributes:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Note
I'm using the topic Create a Key (Portal) in this official Azure lab tutorial.
I believe the name of the cmdlet should be the singular Set-AzureKeyVaultKeyAttribute, rather than the plural Set-AzureKeyVaultKeyAttributes. Note that this is one of the Strongly Encouraged Development Guidelines for Powershell by Microsoft:
To enhance the user experience, the noun that you choose for a cmdlet name should be singular. For example, use the name Get-Process instead of Get-Processes. It is best to follow this rule for all cmdlet names, even when a cmdlet is likely to act upon more than one item.
If you are still seeing the same problem while using a singular name, ensure that the AzureRM.KeyVault module is installed and loaded:
Install-Module AzureRM.KeyVault
Import-Module AzureRM.KeyVault

psexec not recognized

I am working on a Microsoft Server 2008 machine. For some reason, the command "psexec" is not working from powershell on this 1 machine.
When I try to run it I get this:
PS C:\> psexec
The term 'psexec' 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:7
+ psexec <<<<
+ CategoryInfo : ObjectNotFound: (psexec:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
PS C:\>
It is running powershell 2.0. I found this out by doing:
PS C:\> $Host.Version
Major Minor Build Revision
----- ----- ----- --------
2 0 -1 -1
PS C:\>
Any thoughts? I need this command and I'd really prefer not to use a "work around".
Completing the Answer:
You must need to download PSEXEC from the link below and keep in path the launch from Powershell or any Command prompt:
http://technet.microsoft.com/en-us/sysinternals/bb897553