Get-CsUser error powershell

29,765

Does anyone knows what s the cause of this error? thank you in advance

Problem is office 365 skype for business does not have a command "Get-CsUser" under User cmdlets.

Available User cmdlets are as follows.

Set-CsUser

Get-CsUserPstnSettings

Set-CsUserPstnSettings

Get-CsUserSession

Source "Skype for Business Online cmdlets"

Get-CsUser is available for on-premises lync servers.
.

PS: Your connection for "office 365 skype for business" and the session import should be ok, for example if you type Get-CsUserSession, it should not say "The term 'Get-CsUserSession' is not recognized as the name of a cmdlet, function, script file, or operable program"

(1) You can view available commands in your imported module using below

Get-Command -Module MSOnline
Get-Command -Module SkypeOnlineConnector

(2) You can also view available commands in your current session by using Get-Command and your temporary session name.

Get-Command -Module tmp_aqu5qmxt.frb

tmp_aqu5qmxt.frb is my temperory session id name .. change it to whatever you get at this screen.

enter image description here

(3) To view all imported commands from all your sources, (modules+sessions) you can use,

Get-Command -ListImported

None of them has a command called "Get-CsUser"

Share:
29,765
Sudoku
Author by

Sudoku

Updated on June 11, 2020

Comments

  • Sudoku
    Sudoku almost 4 years

    I am running this command in powershell Get-CsUser and i am getting the following error

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

    What do I have to do to avoid this error? I have imported:

    Import-Module "C:\Program Files\Common Files\Skype for Business Online\Modules\SkypeOnlineConnector\SkypeOnlineConnector.psd1"
    

    and then made connection to Office 365 Skype for business service with the following script:

    $credential = Get-Credential
    Import-Module MSOnline
    Connect-MsolService -Credential $credential
    Import-Module SkypeOnlineConnector
    $lyncSession = New-CsOnlineSession -Credential $credential
    Import-PSSession $lyncSession
    

    Does anyone knows what's the cause of this error?

  • Sudoku
    Sudoku almost 6 years
    Thank you very much for your detailed answer. What I would like to do is to get the list of users of Office 365 Skype for Business: I used your commands for better understanding (i am very new to PowerShell) and then searched a little bit more on the internet and came across to this command: Get-Msoluser, maybe I can use this one. If you have any other suggestion please do. Thank you again.
  • Aravinda
    Aravinda almost 6 years
    if it is about skype for business users , user Get-CsOnlineUser instead of Get-Msoluser . examples > docs.microsoft.com/en-us/powershell/module/skype/…
  • Aravinda
    Aravinda almost 6 years