Powershell Script to filter new Entra AD users

38 Views Asked by At

I am trying to create a script to filter users recently created on Entra ID and set their usage location.

$When = ((Get-Date).AddDays(-1)).Date
get-MsolUser -SearchString {whenCreated -ge $When} -Properties whenCreated | Set-MsolUser -UsageLocation US

I am getting an error related to the parameter -Properties, as indicated below:

Get-MsolUser : A parameter cannot be found that matches parameter name 'Properties'.

Can someone help me figuring out how to: Search for users created up to a day ago and set their UsageLocation?

Thanks!

$When = ((Get-Date).AddDays(-1)).Date
get-MsolUser -SearchString {whenCreated -ge $When} -Properties whenCreated | Set-MsolUser -UsageLocation US
0

There are 0 best solutions below