command line - PowerShell Remove all users from a specific group -
i'm trying clean users local grouping test_group executing next command below on windows 2008 r2 standard, powershell 2.0.
get-adgroupmember "test_group" | foreach-object {remove-adgroupmember "test_group" $_ -confirm:$false}
it throws next error, because i'm using v2.0?:
the term 'get-adgroupmember' not recognized name of cmdlet, function, script file, or operable program. che ck spelling of name, or if path included, verify path right , seek again. @ line:1 char:18 + get-adgroupmember <<<< "test_group" | foreach-object {remove-adgroupmember "test_group" $_ -confirm:$false} + categoryinfo : objectnotfound: (get-adgroupmember:string) [], commandnotfoundexception + fullyqualifiederrorid : commandnotfoundexception
i tried many ideas article , comments, , couldn't work i'm not sysadmin , i'm not sure if i'm not missing something?: http://blogs.technet.com/b/heyscriptingguy/archive/2009/07/28/hey-scripting-guy-how-do-i-remove-all-group-members-in-active-directory.aspx
please help, have around 300 groups clean on mon , don't want manually...
not sure if if typo or how running command should get-adgroupmember
get-adgroupmember "test_group" | foreach-object {remove-adgroupmember "test_group" $_ -confirm:$false}
that worked me had refresh aduc ou see alter though
edit
import activedirectory module first seek , run command.
import-module activedirectory get-adgroupmember "test_group" | foreach-object {remove-adgroupmember "test_group" $_ -confirm:$false}
powershell command-line active-directory
No comments:
Post a Comment