Problems setting up Azure in Powershell - powershell

I'm trying to follow the directions here: Azure Resource Manager Cmdlets
I do this:
PS C:\> Install-Module AzureRM
That works, then I try this:
PS C:\> Install-AzureRM
I get this message:
Install-AzureRM : The term 'Install-AzureRM' is not recognized as the name of a cmdlet, function, script file, or operable program.
What am I missing?

The Install-Module in article you came across is referring to cmdlet come with WMF5.0. In other words, only available in Powershell 5.0
There is another version of Install-Module come with PsGet, but that one won't accomplish your task (Install-Module AzureRM), so please try to avoid it.
If you don't want to install powershell 5.0, but want azure cmdlet, you can find stand-alone module installer here.

I believe you want to use Import-AzureRM instead of Install-AzureRM

Related

Powershell cmdlet is not recognized despite having the correct module installed

I am trying to run a powerhsell script (my_script). The script is stored in this_folder on the desktop. I am executing the command at the the correct path by using C:\Users\me\desktop\this_folder> .\my_script. When I try to do this I get the error
The term 'Add-AzureRmAccount' 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
I know that the Add-AzureRmAccount is a part of the AzureRM.Profile module. When I got to the modules folder, I see that AzureRM.Profile is listed. To get these modules, I ran Install-Module -name AzureRM and Import-module AzureRM.
Any ideas what might be going on?
---Update---
When I ran Get-Module commands I saw that only that AzureRM module was listed. I thne tried to run Install-Module -Name AzureRM.Profile and got the error:
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:1772 char:21
+ ... $null = PackageManagement\Install-Package #PSBoundParameters
Since I see the AzureRM.Profile folder with a nupkg at one of the paths listed by $env:PSModulePath I thought I could just run Import-Module -Name AzureRM.Profile and I get the error
import-module : The specified module 'AzureRM.Profile' was not
loaded because no valid module file was found in any module directory.
Any ideas?
You say that you've installed and imported the AzureRM module, but have you connected the Azure account with the Connect-AzureRmAccount cmdlet?
I know a number of other modules does not expose all of the available cmdlets until there is an active connection to an account/subscription.
Be aware that scripts can ignore the context in which they are run so you might need to add the following to the start of the script:
Import-Module AzureRM
Connect-AzureRmAccount
Rather than running them manually in the console and then running the script.
You might want also want to look at using the Az module instead as the AzureRM module is being retired, and will only get bug-fixes till the end of December 2020: Introducing the new Azure PowerShell Az module

What is the purpose of ImportSystemModules?

What is the purpose of ImportSystemModules? Using help ImportSystemModules -Full produces an empty shell description.
PS 09:12 C:\src
>get-command *module*
CommandType Name Version Source
----------- ---- ------- ------
Function Find-Module 2.2.1 PowerShellGet
Function Get-InstalledModule 2.2.1 PowerShellGet
Function **ImportSystemModules**
Function InModuleScope 3.4.0 Pester
Function Install-Module 2.2.1 PowerShellGet
...
From Roger Lipscombe's blog, it used to do the following:
This runs Powershell.exe -ImportSystemModules, which, in turn, runs the ImportSystemModules command. You can call this command as part of your profile, if you want these modules loaded each time you run PowerShell.
Various places on the Internet state that it loads the available modules from C:\Windows\System32\WindowsPowerShell\v1.0\Modules. Among these are modules for managing IIS, Hyper-V, etc.
It turns out that it also loads snap-ins from C:\Users\rogerl\Documents\WindowsPowerShell\Snapins
However, according to another SO answer:
The -ImportSystemModules switch has no impact in v3, looks like it is going away.
And the Powershell changelog states for v6 beta 9 states the argument has been removed entirely:
Remove parameters -importsystemmodules and -psconsoleFile from powershell.exe. (#4995)
And indeed, running Get-Command ImportSystemModules on Powershell Core v6 cannot find the command anymore:
> Get-Command ImportSystemModules
Get-Command : The term 'ImportSystemModules' is not recognized as the name of a cmdlet, function, script file, or operable program.
As to why it's still there and defined in v5.1 and earlier? Perhaps it's for backwards compatibility, v2 compatibility was guaranteed for a long time.

The term 'Add-AzureAccount' is not recognized

I have install Windows azure powershell.
After that when i start as the Windows azure powershell as administrator i am getting an error ---
Saying The term 'Add-AzureAccount' is not recognized
How can i fix this error Anyone knows any solution !!
Before running that cmdlet, can you try
Import-Module Azure
if the module is not found, you can try
Install-Module Azure
Be sure to run powershell as administrator for the latter.

There is no Get-GacAssembly cmdlet

Windows 8.1, PowerShell 4. I'm wanting to use PS to manage the GAC. I find lots of references to Get-GacAssembly for reading a list, getting detailed info, etc.
But running PS as administrator, and PS ISE, I get an error:
>
The term 'Get-GacAssembly' is not recognized as the name of a cmdlet
Do I need to CD to somewhere? How would I discover where to go to find the cmdlets?
The general answer to your question is that you must first install the module (by adding relevant files to Documents\Powershell\Modules or Windows\System32\WindowsPowershell\v1.0\Modules. Then, you should use Import-Module to load the cmdlets. Cmdlets in Windows\System32\WindowsPowershell\v1.0\Modules should be loaded by default. Script modules (e.g., modules that export functions) require at least RemoteSigned execution settings to run.

New-FimImportObject is not recognized by PowerShell

I am not able to use New-FimImportObject command, it is not recognized by PowerShell.
Can someone tell me what the possible reasons are?
I am using PowerShell 3.0.
It sounds like the module is not loaded and if you are running V3, it should have autoloaded if the module was in its proper location:
($Env:PSModulePath -split ';')[0]
You should make sure that the module is placed in this path so it can provide the functions you need to use.
You can also check for all of the available modules by running this:
Get-Module -ListAvailable