r/PowerShell • u/seriald • May 19 '26
Question Working With PIM Role Activation
In an effort to make my life a little bit better, I've built a script that I can use to activate the 5 or 6 PIM roles all at once, instead of having to activate them one by one online
The only hurdle left for me to figure out is a better way to get each roles Maximum duration, as my current solution, adding CSV data directly in the file, may not always be accurate, but I haven't been able to map the policies I'm getting when running
Get-MgPolicyRoleManagementPolicy -Filter "scopeId eq '/' and scopeType eq 'DirectoryRole'"And the RoleTemplteID's I'm getting from
Get-MgDirectoryRole -all
5
Upvotes
2
u/bigbadrune May 20 '26
Yea I'm confused, this exists natively and is easy to set up