-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Renamed script, and added a new one.
- Loading branch information
JacFearsome
committed
Jan 8, 2018
1 parent
88c8224
commit 4ccce03
Showing
5 changed files
with
82 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
debug.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
# This script retrieves all the computers listed in Active Directory, tests their network settings, and creates an html report. | ||
# NOTE: test-server.ps1 is included in this directory, and it is required for this script to work. | ||
. "$PSScriptRoot\test-server.ps1" | ||
|
||
$reportPath = $PSScriptRoot + "\ActiveDirectoryComputersNetwork.html" | ||
# Grab list of computers in Active Directory | ||
$servers = Get-ADComputer -Filter * | ||
|
||
$serversNet = @() | ||
|
||
foreach ($server in $servers) { | ||
Write-Host "Testing "$server.DNSHostName | ||
$results = Test-Server -ComputerName $server.DNSHostName | ||
$serversNet += $results | ||
} | ||
|
||
$serversHtml = $serversNet | ConvertTo-Html -Fragment -PreContent "<h2>AD Computers - Network Status</h2>" | ||
|
||
# Create HTML file | ||
$head = @" | ||
<title>AD Computer List</title> | ||
<style> | ||
body { | ||
background-color: #FFFFFF; | ||
font-family: sans-serif; | ||
} | ||
h1 { | ||
color: #1E87F0; | ||
} | ||
h2 { | ||
color: #1E87F0; | ||
} | ||
table { | ||
background-color: #1E87F0; | ||
} | ||
td { | ||
background-color: #FFFFFF; | ||
color: #666666; | ||
padding: 3px; | ||
} | ||
th { | ||
background-color: #1E87F0; | ||
color: #FFFFFF; | ||
text-align: left; | ||
padding: 3px; | ||
} | ||
</style> | ||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> | ||
<script> | ||
function filter(element) { | ||
var value = `$(element).val().toLowerCase(); | ||
`$("table > tr").hide().filter(function() { | ||
return `$(this).children('td:first-child').text().toLowerCase().indexOf(value) > -1; | ||
}).show(); | ||
} | ||
`$('#search').keyup(function() { | ||
filter(this); | ||
}); | ||
</script> | ||
"@ | ||
|
||
$searchbar = @" | ||
<input type='text' placeholder='Search by DNS Host Name...' id='search' /> | ||
"@ | ||
|
||
# Convert everything to HTML and output to file | ||
ConvertTo-Html -Head $head -Body "$searchbar$serversHtml" | Out-File $reportPath |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters