Get-CsUser error powershell

Sudoku picture Sudoku · Jun 8, 2018 · Viewed 22.7k times · Source

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?

Answer

Aravinda picture Aravinda · Jun 9, 2018

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"