#Version du 13 juin 2013
Clear-Host
function Get-ScriptDirectory
{
$Invocation = (Get-Variable MyInvocation -Scope 1).Value
$ScriptFolderPath = Split-Path $Invocation.MyCommand.Path
return $ScriptFolderPath
}
function CheckQuestActiveRolesADM()
{
#Test la présence des outils Quest
$Error.Clear()
Get-PSSnapin Quest.ActiveRoles.ADManagement
if($Error.Count -ne 0)
{
Clear-Host
Write-Host "`n`n`t`t ERROR - To run this script, the Quest.ActiveRoles.ADManagement must be installed and registered with Powershell." -foregroundcolor red -backgroundColor yellow
Write-Host "`t`t go to the Settings menu in Powershell Plus and click on Manage Snapins." -foregroundcolor red -backgroundColor yellow
break
}
}
#Test de la présence des outils Quest
CheckQuestActiveRolesADM
$NomFichierResultat = "UserGroupExtract_Result.txt"
$NomGroupe = [string]
$MonResultat = [string]
$MonResultat = Read-Host "Login à analyser"
if ($MonResultat.Length -igt 0){
$EmplacementFichier = Get-ScriptDirectory
$EmplacementFichierResultat = "$EmplacementFichier\$NomFichierResultat"
$MonFichierResultat = New-Item -type file $EmplacementFichierResultat -Force
add-content $MonFichierResultat "Groupes AD du compte $MonResultat"
$objUserSource = get-qaduser -SamAccountName $MonResultat
foreach ($UneLigne in $objUserSource.memberof){
$UnGroupe = Get-QADGroup $UneLigne
$NomGroupe = $UnGroupe.GroupName
add-content $MonFichierResultat "$NomGroupe"
}
}
else{
Write-Host "Vous n'avez rien saisi"
}
Write-Host "Terminé !"
Lien vers le fichier : cliquez ici
Téléchargement(s)
Nom | Site Web d origine | Description |
---|---|---|
PowerGUI.3.5.0.2293.msi | http://www.powergui.org/downlo... | PowerGui - Interface de développement en PowerShell |
Quest_ActiveRolesManageme... | http://www.quest.com/powershel... | Plug in ActiveRoles de Quest pour gérer l'AD |
Article(s) suivant(s)