# Add Quest Active Directory Snapin
Add-PSSnapin quest.ActiveRoles.admanagement
#Create an empty array
$results = @()
#Query all AD users & assign to an array
$allusers = get-qaduser
#Loop through array, if logon script is present, add it to the arrary
foreach ($i in $allusers)
{
if ($i.logonscript)
{
$results += $i | select name,logonscript
}
}
#Export results into a CSV file
$results | Export-Csv -NoTypeInformation c:\bin\logonscript.csv
No comments:
Post a Comment