SOLVED

The term '...' is not recognized as the name of a cmdlet

Brass Contributor

Hi,


I am new to PowerShell. I am running on Win7 and I have the following module installed.

cllee_0-1590310474113.png

 

I constantly hit with  error: The term '...' is not recognized as the name of a cmdlet, function,....

 

I tried google around for solutions and there is a lot of articles, but only keeps throwing more error after error. Is there anyway to verify what is missing?

 

Can anyone point me to the right direction, any step-by-step guide? Like what needs to be installed first, or how to install guide? Or how to check what is still required?

 

Thanks.

18 Replies

@cllee :smile:

 

Hi, what are you trying to do it PowerShell please?  There are any number of modules you may need.  It would help if you could explain what you want to achieve and then we can try and advise you.  :smile:

Hi @PeterRising 

 

I would like to run some commands to extract some data. A couple of it will be Get-ADUser and Get-MsolUser

 

Thanks.

best response confirmed by cllee (Brass Contributor)
Solution

@cllee 

 

OK, please try the following commands in PowerShell;

 

Install-Module MSOnline

 

then,

 

Import-Module MSOnline

 

then try to connect to the MS Online service by entering;

 

Connect-MsolService

 

You should be prompted now for your M365 Global Admin credentials.  Login and you can run the Get-MsolUser commands.

 

In order to execute the Get-ADUser commands, try running Import-Module activedirectory

 

Hi @PeterRising 

 

Hit error on first command :

cllee_0-1590319634443.png

 

@cllee 

 

Sounds like you may be behind a proxy server? If so, please try the following commands in PowerShell;

 

$webclient=New-Object System.Net.WebClient
$webclient.Proxy.Credentials = [System.Net.CredentialCache]::DefaultNetworkCredentials

Then try the commands again.  Alternatively, can you break straight out to the internet and bypass your proxy server? 

@PeterRising 

I don't think I am behind any proxy, not that i know of. I have tried disabled the antivirus anyway.

But still hit another error:

cllee_0-1590320713532.png

 

 

@cllee 

 

OK, could be a TLS problem.  Try also running this command;

 

Net.ServicePointManager]::SecurityProtocol = "tls12"

 

@cllee 

 

Sorry, I missed a bracket at the start.  Try again please with correct command.

 

[Net.ServicePointManager]::SecurityProtocol = "tls12"

@PeterRising 

 

It works! Thanks. I realized it needs to be run on a 64bit PS.

 

Also I noticed certain commands we need to first connect to the O365 by:

$UserCredential = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection
Import-PSSession $Session


But in the steps you provided, we don't have to? What is the difference?

Thanks.

 

@cllee 

 

Glad you have got it to work.  To answer your question, the commands you have listed here connect you to Exchange Online PowerShell as opposed to connecting to MSOnline.  Exchange Online PowerShell will allow you to manage mailboxes and groups and connectors (all things mail really), whereas the MSOnline service allows you to manage User Objects, Licences, etc etc.

@PeterRising 

Thanks. Appreciate your help.

@PeterRising ,

 

I am trying to run the Set-CsUser command but it throws an error "The term 'Set-CsUser' is not recognized as the name of a cmdlet." I guess I am missing that cmdlet in a module? Can you please guide me on how to fix this. Thank you.

when i installing exchange server i face error on the prerequisite

Install–WindowsFeature : The term 'Install–WindowsFeature' 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
+ Install–WindowsFeature RSAT–Clustering–CmdInterface, NET–Framework–45 ...
+ ~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Install–WindowsFeature:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException

 

this is the error

 

 

@PeterRising 

 

Hi, I'm new to powershell and I'm trying to run this command 'Get-NetDomain" but it's returning this error:

 

"Get-NetDomain : The term 'Get-NetDomain' 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-NetDomain
+ ~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Get-NetDomain:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException"

 

Any idea how I can fix that?

@PeterRising 

hey i got the error after this command,

[Net.ServicePointManager]::SecurityProtocol = "tls12"

 

hritwizagupta_0-1698647508763.pnghritwizagupta_1-1698647514254.png

 

@hritwizagupta 

 

The library reference is incorrect.

 

It should be:

 

[System.Net.ServicePointManager]::SecurityProtocol

 

Not:

 

[Net.ServicePointManager]::SecurityProtocol

 

Cheers,

Lain

You should set the TLS 1.2 Registry Keys
https://blog.icewolf.ch/archive/2020/12/03/admins-setzt-endlich-die-tls-1-2-eintrage-fur-dotnetpower...

This is just a temporary workaround
[System.Net.ServicePointManager]::SecurityProtocol = "tls12"

And you need to Run PowerShell as Administrator to install the Module
https://blog.icewolf.ch/archive/2023/10/29/powershell-module-microsoft-online-sharepoint-powershell-...

Or use the Scope Parameter
Install-Module MSOnline -Scope CurrentUser

Regards
Andres
1 best response

Accepted Solutions
best response confirmed by cllee (Brass Contributor)
Solution

@cllee 

 

OK, please try the following commands in PowerShell;

 

Install-Module MSOnline

 

then,

 

Import-Module MSOnline

 

then try to connect to the MS Online service by entering;

 

Connect-MsolService

 

You should be prompted now for your M365 Global Admin credentials.  Login and you can run the Get-MsolUser commands.

 

In order to execute the Get-ADUser commands, try running Import-Module activedirectory

 

View solution in original post