Link to home
Start Free TrialLog in
Avatar of U.S.
U.S.

asked on

AD SCRIPT THAT PROMPTS FOR GROUP NAME AND OUTPUTS FILE

Attempting to create a script that prompts for a specified AD group name to verify if user accounts are disabled and create an output file with the output displayed from PowerShell.  So far this is what I have but I am receiving an blank output.

[void][System.Reflection.Assembly]::LoadWithPartialName('Microsoft.VisualBasic')

$group = [Microsoft.VisualBasic.Interaction]::InputBox("Please enter group name", "Group", "$env:username")

Get-ADGroupMember -identity "$group" | get-aduser | Where {$_.Enabled -eq $false} | format-table name -autosize

Out-File -Force "C:\AD_output.txt"
ASKER CERTIFIED SOLUTION
Avatar of oBdA
oBdA

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of U.S.
U.S.

ASKER

Awesome this works beautifully! Thanks for helping out a newbie to PS.