May 24 2020 02:03 AM
Hi,
I am new to PowerShell. I am running on Win7 and I have the following module installed.
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.
May 24 2020 02:37 AM
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.
May 24 2020 02:45 AM
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.
May 24 2020 02:52 AM
Solution
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
May 24 2020 04:27 AM
May 24 2020 04:35 AM
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?
May 24 2020 04:45 AM
@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:
May 24 2020 07:00 AM
OK, could be a TLS problem. Try also running this command;
Net.ServicePointManager]::SecurityProtocol = "tls12"
May 24 2020 07:20 AM
May 24 2020 08:40 AM
Sorry, I missed a bracket at the start. Try again please with correct command.
[Net.ServicePointManager]::SecurityProtocol = "tls12"
May 24 2020 11:21 PM
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.
May 24 2020 11:26 PM
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.
May 27 2020 12:50 AM
@PeterRising
Thanks. Appreciate your help.
Aug 25 2020 03:48 PM
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.
Nov 11 2020 04:57 AM
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
Jul 23 2022 06:52 AM
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?
Oct 29 2023 11:32 PM
hey i got the error after this command,
[Net.ServicePointManager]::SecurityProtocol = "tls12"
Oct 29 2023 11:57 PM
The library reference is incorrect.
It should be:
[System.Net.ServicePointManager]::SecurityProtocol
Not:
[Net.ServicePointManager]::SecurityProtocol
Cheers,
Lain
Nov 01 2023 03:34 PM
May 24 2020 02:52 AM
Solution
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