Box PowerShell command to get inactive users
回答済みI needed to give my operations team a way of getting the inactive users in Box. Using the reports was complicated and I had to join 2 reports to get what I needed. So I tried using the CLI and PowerShell and got to this command that extracts users into a CSV file sorted by the modified date for users who have not interacted with box for the last 120 days. I also exclude the customer's accounts as I don't want to remove customers even if they are not using the system at the moment.
As always (for me at least) getting the correct mix of brackets ((){}[]) for PowerShell took time but I like how concise it is. abc_inc is the company name I am excluding. Just thought I would share this as it took me a few hours to perfect.
(box users -a --json | ConvertFrom-Json) | Select-Object -Property id,name,login, created_at,modified_at,space_used,status, @{Name='CreatedDateTime';Expression={([Datetime] $_.created_at)}}, @{Name='ModifiedDateTime';Expression={([Datetime] $_.modified_at)}} |Sort-Object -property ModifiedDateTime | where ModifiedDateTime -lt (Get-Date).AddDays(-120) |where login -notmatch "abc_inc" | Export-Csv .\boxusers.csv -NoTypeInformation
-
正式なコメント
Thanks for sharing your solution.
Also, recently our team put together some CLI sample script and Report to get inactive users is there.
You can follow user guide or jump straight to the script.コメントアクション
サインインしてコメントを残してください。
コメント
1件のコメント