资讯

精准传达 • 有效沟通

从品牌网站建设到网络营销策划,从策略到执行的一站式服务

如何进行PowerShell脚本域策略管理

如何进行PowerShell 脚本域策略管理,很多新手对此不是很清楚,为了帮助大家解决这个难题,下面小编将为大家详细讲解,有这方面需求的人可以来学习下,希望你能有所收获。

公司主营业务:成都网站设计、网站建设、移动网站开发等业务。帮助企业客户真正实现互联网宣传,提高企业的竞争能力。创新互联建站是一支青春激扬、勤奋敬业、活力青春激扬、勤奋敬业、活力澎湃、和谐高效的团队。公司秉承以“开放、自由、严谨、自律”为核心的企业文化,感谢他们对我们的高要求,感谢他们从不同领域给我们带来的挑战,让我们激情的团队有机会用头脑与智慧不断的给客户带来惊喜。创新互联建站推出玉环免费做网站回馈大家。

大中型企业中,会设置许多组策略进行日常运维管理 ,毕然里面也存在许多废弃的策略,需要我们定期清理我们的组策略信息。通常我们导出HTML报告方式来帮助我们分析组策略信息:

#1

首先需要加载GroupPolicy模块:

Import-Module GroupPolicy

将GPO导出为一个HTML报告:

Get-GPOReport -All -ReportType html -Path C:\GPOReports\GposReport.html

#2

将每个GPO导出生成自己的HTML报告中:

Get-GPO -All | %{
Get-GPOReport -name $_.displayname -ReportType html -path ("c:\GPOReports\"+$_.displayname+".html")
}

#3

让我们查询所有设置被禁用的GPO策略:

$reportFile = "c:\GPOReports\AllSettingsDisabledGpos.csv"
Set-Content -Path $reportFile -Value ("GPO Name,Settings")
Get-GPO -All | where{ $_.GpoStatus -eq "AllSettingsDisabled" } | % {
add-Content -Path $reportFile -Value ($_.displayName+","+$_.gpoStatus)
}

#4

查询没有应用到任何用户的Gpo策略

$reportFile = "c:\GPOReports\GPOApplyToPermissions.csv"
Set-Content -Path $reportFile -Value ("GPO Name,User/Group,Denied")
Get-GPO -All | %{
$gpoName = $_.displayName
[int]$counter = 0
$security = $_.GetSecurityInfo()
$security | where{ $_.Permission -eq "GpoApply" } | %{
add-Content -Path $reportFile -Value ($gpoName + "," + $_.trustee.name+","+$_.denied)
$counter += 1
}
if ($counter -eq 0)
{
add-Content -Path $reportFile -Value ($gpoName + ",NOT APPLIED")
}
}

#4

获取GPO,链接和WMI过滤器:

$reportFile = "c:\GPOReports\GPOLinksAndWMIFilters.csv"
Set-Content -Path $reportFile -Value ("GPO Name,# Links,Link Path,Enabled,No Override,WMI Filter")
$gpmc = New-Object -ComObject GPMgmt.GPM
$constants = $gpmc.GetConstants()
Get-GPO -All | %{
[int]$counter = 0
[xml]$report = $_.GenerateReport($constants.ReportXML)
try
{
$wmiFilterName = $report.gpo.filtername
}
catch
{
$wmiFilterName = "none"
}
$report.GPO.LinksTo | % {
if ($_.SOMPath -ne $null)
{
$counter += 1
add-Content -Path $reportFile -Value ($report.GPO.Name + "," + $report.GPO.linksto.Count + "," + $_.SOMPath + "," + $_.Enabled + "," + $_.NoOverride + "," + $wmiFilterName)
}
}
if ($counter -eq 0)
{
add-Content -Path $reportFile -Value ($report.GPO.Name + "," + $counter + "," + "NO LINKS" + "," + "NO LINKS" + "," + "NO LINKS")
}
}

#5

查询具有阻止GPO继承的组织单位:

Import-Module ActiveDirectory
$reportFile = "c:\GPOReports\OUsWithBlockInharit.csv"
set-Content -Path $reportFile -Value ("Block Inharitance OU Path")
Get-ADOrganizationalUnit -SearchBase "DC=Your,DC=Domain" -Filter * | Get-GPInheritance | Where-Object { $_.GPOInheritanceBlocked } | %{
add-Content -Path $reportFile -Value ($_.path)
}

看完上述内容是否对您有帮助呢?如果还想对相关知识有进一步的了解或阅读更多相关文章,请关注创新互联行业资讯频道,感谢您对创新互联的支持。


文章标题:如何进行PowerShell脚本域策略管理
URL网址:http://cdkjz.cn/article/pgeech.html
多年建站经验

多一份参考,总有益处

联系快上网,免费获得专属《策划方案》及报价

咨询相关问题或预约面谈,可以通过以下方式与我们联系

业务热线:400-028-6601 / 大客户专线   成都:13518219792   座机:028-86922220