Hi Microsoft,
We would like to block multiple users account to access to Office 365 by PowerShell. By this KB:
https://technet.microsoft.com/en-us/library/mt628066.aspx
After I connect to Office 365 and run this command
Get-Content "D:\UserBlock.txt" | Set-MsolUser -UserPrincipalName $_.UserPrincipalName -BlockCredential $true
Then we found this error:
Set-MsolUser : The input object cannot be bound to any parameters for the command either because the command does not
take pipeline input or the input and its properties do not match any of the parameters that take pipeline input.
At line:1 char:34
- ... lock.txt" | Set-MsolUser -UserPrincipalName $_.UserPrincipalName -Blo ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (******@tnc2016.onmicrosoft.com:PSObject) [Set-MsolUser], ParameterBindi
ngException
+ FullyQualifiedErrorId : InputObjectNotBound,Microsoft.Online.Administration.Automation.SetUser
Set-MsolUser : The input object cannot be bound to any parameters for the command either because the command does not
take pipeline input or the input and its properties do not match any of the parameters that take pipeline input.
At line:1 char:34
- ... lock.txt" | Set-MsolUser -UserPrincipalName $_.UserPrincipalName -Blo ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (******@tnc2016.onmicrosoft.com:PSObject) [Set-MsolUser], ParameterBindi
ngException
+ FullyQualifiedErrorId : InputObjectNotBound,Microsoft.Online.Administration.Automation.SetUser
As we notice, I type this command correctly and txt file is no problem. Please recommend how to resolve this problem.
Regards,
Thanachart R.