Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Web
- more
- Inbox
- (no subject)
- O
- Orwig, Adam J CTR AD, 7.2.4 ISF
- to me
- 4 minutes agoDetails
- $ErrorActionPreference = "SilentlyContinue"
- Function QA-Server {
- param([string]$ComputerName)
- if(Test-Path "\\$ComputerName\Admin`$"){
- $Global:Output = "\\Server\Software\QA\$ComputerName.html"
- Clear-Content $output -ErrorAction SilentlyContinue
- Write-Host "Creating QA Sheet for $ComputerName`..."
- Start-HTML -ComputerName $ComputerName
- "<h2>Hardware Information:</h2><hr>" | Add-Content $output
- Get-DriveInfo -ComputerName $ComputerName
- Get-NICInfo -ComputerName $ComputerName
- Get-PersistentRoutes -ComputerName $ComputerName
- Get-ProcessorInfo -ComputerName $ComputerName
- Get-RAMInfo -ComputerName $ComputerName
- "<h2>Software Information:</h2><hr>" | Add-Content $output
- Get-WindowsInfo -ComputerName $ComputerName
- Get-Applications -ComputerName $ComputerName
- End-HTML
- }
- else{
- #Write-Host "Could not connect to '$ComputerName'! Please enter a valid server name." -ForegroundColor Red -BackgroundColor Black
- throw "Could not connect to '$ComputerName'! Please enter a valid server name."
- }
- }
- #Start HTML=====================================================================================================================================
- Function Start-HTML{
- param([string]$ComputerName)
- $date = Get-Date -Format "hh:mm MM/dd/yyyy"
- "<HTML>
- <HEAD>
- <title>$ComputerName QA Checklist</title>
- <style type='text/css'>
- body{
- font-family:calibri;
- background-color:#dddddd;
- width:800px;
- }
- h1 {
- margin-bottom:0px;
- }
- p {
- margin-top:0px;
- text-decoration:underline;
- }
- h2{
- margin-bottom:0px;
- margin-top:45px;
- }
- h3 {
- margin-bottom:0px;
- margin-top:20px;
- }
- table{
- border:2px solid #aaaaaa;
- width:99%;
- background-color:#cccccc;
- }
- td {
- background-color:white;
- border:1px solid #aaaaaa;
- }
- .bold {
- font-weight:bold;
- }
- </style>
- </HEAD>
- <BODY>
- <h1>$ComputerName QA Checklist</h1>
- <p>Created by $env:username on $date</p>
- " | Add-Content $Output
- }
- #Drive Info=============================================================================================================================
- Function Get-DriveInfo {
- param([string]$ComputerName)
- $wmi = Get-WmiObject -Class Win32_LogicalDisk -ComputerName $ComputerName
- "<h3>Drive Information:</h3>
- <table>
- <tr>
- <td class='bold'>Drive Letter:</td>
- <td class='bold'>Drive Name:</td>
- <td class='bold'>Drive Size:</td>
- </tr>
- " | Add-Content $Output
- foreach($disk in $wmi){
- $Size = ($disk.Size / 1024 / 1024 / 1024)
- $Size = "{0:N3}" -f $Size
- $Name = $disk.name
- $VolumeName = $disk.VolumeName
- "<tr>
- <td>$Name</td>
- <td>$VolumeName</td>
- <td>$Size GB</td>
- </tr>" | Add-Content $Output
- }
- "</table>" | Add-Content $Output
- }
- #Network Adapter Info=====================================================================================================================
- Function Get-NICinfo{
- param([string]$ComputerName)
- $wmi = Get-WmiObject -Class Win32_NetworkAdapterConfiguration -ComputerName $ComputerName
- "<h3>Network Interface Card Information:</h3>
- <table>
- <tr>
- <td class='bold'>Name:</td>
- <td class='bold'>IP Address:</td>
- <td class='bold'>Subnet:</td>
- <td class='bold'>Default Gateway:</td>
- <td class='bold'>DNS IP Addresses:</td>
- <td class='bold'>MTU</td>
- </tr>
- " | Add-Content $Output
- foreach($NIC in $wmi){
- if($NIC.IPaddress){
- $IPAddress = $NIC.IPAddress
- $IPSubnet = $NIC.IPSubnet
- $DefaultIPGateway = $NIC.DefaultIPGateway
- $DNSServerSearchOrder = $NIC.DNSServerSearchOrder
- $MAC = $NIC.MACAddress
- $ID = $NIC.settingID
- $wmi2 = Get-WmiObject -Class Win32_NetworkAdapter -ComputerName $ComputerName -Filter "MACAddress = '$MAC'"
- $Name = $wmi2.NetConnectionID
- try{
- Invoke-Command -ComputerName $ComputerName -ScriptBlock{cmd.exe /c 'netsh interface ipv4 show subinterfaces'} -ErrorAction SilentlyContinue | Tee-Object -FilePath E:\Software\BrandonFallin\temp\temp.txt | Out-Null
- $line = $line.ToString()
- $MTU = $line.Substring(2,4)
- }
- catch{
- $reg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine', $ComputerName)
- $key = $reg.OpenSubKey("SYSTEM\CurrentControlSet\services\Tcpip\Parameters\Interfaces\$ID")
- $MTU = $key.GetValue("MTU")
- }
- "<tr>
- <td>$Name</td>
- <td>$IPAddress</td>
- <td>$IPSubnet</td>
- <td>$DefaultIPGateway</td>
- <td>$DNSServerSearchOrder</td>
- <td>$MTU</td>
- </tr>" | Add-Content $Output
- }
- }
- "</table>" | Add-Content $Output
- }
- #Persistent Routes==========================================================================================================================
- Function Get-PersistentRoutes {
- param([string]$ComputerName)
- "<h3>Persistent Routes:</h3>
- <table>
- <tr>
- <td class='bold'>Route:</td>
- <td class='bold'>NetMask:</td>
- <td class='bold'>Gateway:</td>
- <td class='bold'>Metric:</td>
- </tr>
- " | Add-Content $Output
- $reg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine', "$ComputerName")
- $SubKey = $reg.OpenSubKey('System\\CurrentControlSet\\Services\\Tcpip\\Parameters\\PersistentRoutes')
- foreach($Key in $SubKey.GetValueNames()){
- $string = $key -replace ",","</td><td>"
- "<tr><td>$string</td></tr>" | Add-Content $Output
- }
- "</table>" | Add-Content $Output
- }
- #Processor Info==========================================================================================================================
- Function Get-ProcessorInfo {
- param([string]$ComputerName)
- "<h3>Processor Information:</h3>
- <table>
- <tr>
- <td class='bold'>Processor:</td>
- <td class='bold'>Cores:</td>
- <td class='bold'>Logical Processors:</td>
- </tr>
- " | Add-Content $Output
- $wmi = Get-WmiObject -Class Win32_Processor -ComputerName $ComputerName
- foreach($processor in $wmi){
- $Name = $processor.name
- $NumberOfCores = $processor.NumberOfCores
- $NumberOfLogicalProcessors = $processor.NumberOfLogicalProcessors
- "<tr>
- <td>$Name</td>
- <td>$NumberOfCores</td>
- <td>$NumberOfLogicalProcessors</td>
- </tr>" | Add-Content $Output
- }
- "</table>" | Add-Content $Output
- }
- #RAM Info==============================================================================================================================
- Function Get-RAMInfo {
- param([string]$ComputerName)
- "<h3>Memory (RAM) Information:</h3>
- <table>" | Add-Content $Output
- $wmi = Get-WmiObject -Class Win32_ComputerSystem -ComputerName $ComputerName
- $RAM = [math]::round($wmi.TotalPhysicalMemory / 1024 / 1024 / 1024)
- "<tr>
- <td class='bold'>RAM:</td>
- </tr>
- <tr>
- <td>$RAM.00 GB</td>
- </tr></table>
- " | Add-Content $Output
- }
- #Windows========================================================================================================================================
- Function Get-WindowsInfo{
- param([string]$ComputerName)
- "<h3>Windows Information:</h3>
- <table>
- <tr>
- <td class='bold'>Item:</td>
- <td class='bold'>Status:</td>
- </tr>
- " | Add-Content $Output
- #Operating system version------------------------------------------------------------------------------------------------------
- $wmi = Get-WmiObject -Class Win32_OperatingSystem -ComputerName $ComputerName
- $OSVersion = $wmi.Caption
- $BitType = $wmi.OSArchitecture
- $ServicePack = $wmi.ServicePackMajorversion
- if($ServicePack -gt 0){
- "<tr><td>Operating System</td><td>$OSVersion Service Pack $ServicePack</td></tr>" | Add-Content $Output
- }
- else{
- "<tr><td>Operating System</td><td>$OSVersion</td></tr>" | Add-Content $Output
- }
- "<tr><td>OS Architecture</td><td>$BitType</td></tr>" | Add-Content $Output
- #Application Info===============================================================================================================================
- Function Get-Applications {
- param([string]$ComputerName)
- "<h3>Application Information:</h3>
- <table>
- <tr>
- <td class='bold'>Application:</td>
- <td class='bold'>Status:</td>
- </tr>
- " | Add-Content $Output
- Function Check-Service {
- param([string]$Service)
- $serv = Get-Service -ComputerName $ComputerName -Name $Service -ErrorAction SilentlyContinue
- if($serv.status -ne "Running"){return $false}
- else {return $true}
- }
- #Active Client----------------------------------------------------------------------------------------
- $AcSharedStore = Check-Service -Service "ac.sharedstore"
- if(Test-Path "\\$ComputerName\C`$\Program Files\ActivIdentity\ActivClient\acsagent.exe"){
- if($AcSharedStore){"<tr><td>Active Client</td><td>Installed</td></tr>" | Add-Content $Output}
- else{"<tr><td>Active Client</td><td>Not Functioning Properly</td></tr>" | Add-Content $Output}
- }
- else {"<tr><td>Active Client</td><td>Not Installed</td></tr>" | Add-Content $Output}
- #McAfee----------------------------------------------------------------------------------------------
- $McAfeeAuditManager = Check-Service -Service "McAfeeAuditManager"
- $McAfeeDLPAgentService = Check-Service -Service "McAfeeDLPAgentService"
- $mfefire = Check-Service -Service "mfefire"
- $McAfeeFramework = Check-Service -Service "McAfeeFramework"
- $HipMgmt = Check-Service -Service "HipMgmt"
- $EnterceptAgent = Check-Service -Service "enterceptAgent"
- $McShield = Check-Service -Service "McShield"
- $McTaskManager = Check-Service -Service "McTaskManager"
- $Mfevtp = Check-Service -Service "mfevtp"
- if(Test-Path "\\$ComputerName\C`$\Program Files\McAfee\Host Intrusion Prevention\McAfeeFire.exe"){
- if($McAfeeAuditManager -and $McAfeeDLPAgentService -and $mfefire -and $McAfeeFramework -and $HipMgmt -and $EnterceptAgent -and $McShield -and $McTaskManager -and $Mfevtp){"<tr><td>McAfee</td><td>Installed</td></tr>" | Add-Content $Output}
- else {"<tr><td>McAfee</td><td>Not Functioning Properly</td></tr>" | Add-Content $Output}
- }
- else {"<tr><td>McAfee</td><td>Not Installed</td></tr>" | Add-Content $Output}
- "</table>" | Add-Content $Output
- }
- #End the HTML Document==========================================================================================================================
- Function End-HTML {
- "</BODY></HTML>" | Add-Content $Output
- }
- QA-Server server123
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement