#Function - Pulls GPO Settings and reports them via an HTML document
function Show-GPOReport {
param(
$GPOName = $null,
$filename = "$env:temp\report.hta"
)
Import-Module GroupPolicy
if ($GPOName -eq $null) {
Get-GPO -All | Select-Object -ExpandProperty DisplayName
} else {
Get-GPOReport -Name $GPOName -ReportType Html | Out-File $filename
Invoke-Item $filename
}
}
#Query user for GPO "Name"
$param1 = read-host "Enter Desired GPO"
#Calls function with parameter.
Show-GPOReport $param1
Tuesday, March 6, 2012
Monday, March 5, 2012
Get-Logonscripts
# Add Quest Active Directory Snapin
Add-PSSnapin quest.ActiveRoles.admanagement
#Create an empty array
$results = @()
#Query all AD users & assign to an array
$allusers = get-qaduser
#Loop through array, if logon script is present, add it to the arrary
foreach ($i in $allusers)
{
if ($i.logonscript)
{
$results += $i | select name,logonscript
}
}
#Export results into a CSV file
$results | Export-Csv -NoTypeInformation c:\bin\logonscript.csv
Add-PSSnapin quest.ActiveRoles.admanagement
#Create an empty array
$results = @()
#Query all AD users & assign to an array
$allusers = get-qaduser
#Loop through array, if logon script is present, add it to the arrary
foreach ($i in $allusers)
{
if ($i.logonscript)
{
$results += $i | select name,logonscript
}
}
#Export results into a CSV file
$results | Export-Csv -NoTypeInformation c:\bin\logonscript.csv
First Posting - Powershell Set DNS
#Sets your local DNS settings to public DNS servers
$NICs = Get-WmiObject Win32_NetworkAdapterConfiguration | where{$_.IPEnabled -eq “TRUE”}
Foreach($NIC in $NICs) {
$DNSServers = “4.2.2.2","8.8.8.8"
$NIC.SetDNSServerSearchOrder($DNSServers)
}
#Sets your local DNS settings with no static IP addresses
$NICs = Get-WMIObject Win32_NetworkAdapterConfiguration | where{$_.IPEnabled -eq “TRUE”}
Foreach($NIC in $NICs) {
$NIC.SetDNSServerSearchOrder()
}
$NICs = Get-WmiObject Win32_NetworkAdapterConfiguration | where{$_.IPEnabled -eq “TRUE”}
Foreach($NIC in $NICs) {
$DNSServers = “4.2.2.2","8.8.8.8"
$NIC.SetDNSServerSearchOrder($DNSServers)
}
#Sets your local DNS settings with no static IP addresses
$NICs = Get-WMIObject Win32_NetworkAdapterConfiguration | where{$_.IPEnabled -eq “TRUE”}
Foreach($NIC in $NICs) {
$NIC.SetDNSServerSearchOrder()
}
Subscribe to:
Posts (Atom)