Upgrade to Pro — share decks privately, control downloads, hide ads and more …

PowerShellでActive Directoryを操作してみよう (グループ編)

PowerShellでActive Directoryを操作してみよう (グループ編)


June 07, 2016

More Decks by minase

Other Decks in Programming


  1. View Slide

  2. View Slide

  3. View Slide

  4. Set-ExecutionPolicy RemoteSigned
    Import-Module ActiveDirectory

    View Slide

  5. Get-ADGroup -Filter *
    Get-ADGroup -Filter * -SearchBase 'OUのDN'
    Get-ADGroup -Filter {Name -like "*開発管理部*"}

    View Slide

  6. View Slide

  7. Get-ADGroupMember -Identity 'TestGroup'
    Get-ADGroupMember -Identity 'TestGroup' | Select-Object {$_.SamAccountName}

    View Slide

  8. New-ADGroup -Name 'TestGroup' `
    -Description 'test' `
    -GroupScope Global `
    -GroupCategory Security `
    -Path '作成先OUのDN'

    View Slide

  9. Set-ADGroup -Identity 'TestGroup' -Description 'Change'
    Rename-ADObject -Identity 'グループのDN' -NewName 'TestGroup'
    Set-ADGroup -Identity 'TestGrop' -GroupCategory Distribution
    Get-ADGroup -Identity 'TestGroup' | Set-ADGroup -Description 'change'

    View Slide

  10. Remove-ADGroup -Identity 'TestGroup'
    Remove-ADGroup -Identity 'TestGroup' -Confirm:$false
    Get-ADGroup -Identity 'TestGroup' | Remove-ADGroup

    View Slide

  11. Add-ADGroupMember -Identity 'TestGroup' -Members minase,isami
    Remove-ADGroupMember -Identity 'TestGroup' -Members yamashita
    Get-ADGroup -Identity 'TestGroup' | Add-ADGroupMember -Members yamashita
    Get-ADGroup -Identity 'TestGroup' | Remove-ADGroupMember -Members isami

    View Slide

  12. View Slide