株式会社ヴァンデミックシステム

Blog

<スポンサーリンク>

ADの移行などで、移行用のポリシーには独自の名前を付けるルールにしてる場合とかに便利かなって。
今回は、「ファイア」の文字列を含んでいるGPOのみをバックアップするもの。

 

#GPOの一覧はこんな感じ
PS C:\Users\Administrator> Get-GPO -All | Select-Object -Property DisplayName

DisplayName
-----------
Default Domain Policy
Windowsファイアウォール_2
Default Domain Controllers Policy
ネットワークドライブマウント
ISOマウント
Windowsファイアウォール
WSUS
サービス無効

#ファイアのみで絞ったDisplayNameの値を変数へ代入
PS C:\Users\Administrator> $gpolist = (Get-GPO -All | Select-Object -Property DisplayName | Where-Object {$_.DisplayName -match "ファイア*"}).DisplayName

#foreachに渡して、バックアップ
PS C:\Users\Administrator> $gpolist | ForEach-Object { Backup-GPO -Name $_ -Path $env:USERPROFILE }


DisplayName     : Windowsファイアウォール_2
GpoId           : 375bc051-4dea-4dfd-8c3d-d064eb01c3fa
Id              : 22ec615b-2a5c-4546-b135-bba22d358f56
BackupDirectory : C:\Users\Administrator
CreationTime    : 2017/10/02 1:03:26
DomainName      : kujira.local
Comment         :

DisplayName     : Windowsファイアウォール
GpoId           : a41a6cc9-1c1f-40a7-ac81-46c456abfb40
Id              : c5fcbdfb-58f5-48ed-a5d1-4aac20c15f26
BackupDirectory : C:\Users\Administrator
CreationTime    : 2017/10/02 1:03:26
DomainName      : kujira.local
Comment         :



PS C:\Users\Administrator>

<スポンサーリンク>

コメントを残す

Allowed tags:  you may use these HTML tags and attributes: <a href="">, <strong>, <em>, <h1>, <h2>, <h3>
Please note:  all comments go through moderation.

*

日本語が含まれない投稿は無視されますのでご注意ください。(スパム対策)