Last active
February 25, 2020 20:47
-
-
Save 1951FDG/162859d0b3a2da2bbc4ecdfc2cfc69ae to your computer and use it in GitHub Desktop.
For use with https://github.com/mbegan/Okta-PSModule
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Param | |
( | |
[Parameter(Mandatory=$true)][alias('org','OktaOrg')][string]$oOrg | |
) | |
$groups = oktaGetGroupsAll -oOrg $oOrg | |
foreach ($g in $groups) | |
{ | |
if ($g.objectClass -eq 'okta:user_group') | |
{ | |
$groupUsers = oktaGetGroupMembersbyId -oOrg $oOrg -gid $g.id -limit 200 -enablePagination $true | |
$toexport = New-Object System.Collections.ArrayList | |
foreach ($u in $groupUsers) | |
{ | |
$line = [ordered]@{ | |
email = $u.profile.email | |
login = $u.profile.login | |
firstName = $u.profile.firstName | |
lastName = $u.profile.lastName | |
oktaid = $u.id | |
} | |
$obj = New-Object psobject -Property $line | |
$_c = $toexport.Add($obj) | |
} | |
# $path = $home + '\Documents\WindowsPowerShell\Modules\Okta\' + $g.profile.name + '.csv' | |
$path = '\\tsclient\Okta-Scripts\\Okta\' + $g.profile.name + '.csv' | |
$toexport | Export-Csv -Path $path -NoTypeInformation | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Param | |
( | |
[Parameter(Mandatory=$true)][alias('org','OktaOrg')][string]$oOrg | |
) | |
$users = oktaListUsers -oOrg $oOrg | |
$toexport = New-Object System.Collections.ArrayList | |
foreach ($u in $users) | |
{ | |
$line = [ordered]@{ | |
email = $u.profile.email | |
login = $u.profile.login | |
firstName = $u.profile.firstName | |
lastName = $u.profile.lastName | |
oktaid = $u.id | |
} | |
$obj = New-Object psobject -Property $line | |
$_c = $toexport.Add($obj) | |
} | |
#$path = $home + '\Documents\WindowsPowerShell\Modules\Okta\' + 'Everyone' + '.csv' | |
$path = '\\tsclient\Okta-Scripts\Okta\' + 'Everyone' + '.csv' | |
$toexport | Export-Csv -Path $path -NoTypeInformation |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment