Solved

Required Detail Networking information embedded with this PowerShell Script

Posted on 2014-01-24
1
224 Views
Last Modified: 2014-01-28
I'm just beginning to learn Power Shell.  I discovered this very useful script {http://gallery.technet.microsoft.com/Windows-System-Inventory-616e2749} that i would like to retrieve also the network adapter information listed in this link { http://gallery.technet.microsoft.com/scriptcenter/Get-Network-Information-of-6d07766f}  and if at all possible have this written out in a csv format.  If not, and too much trouble, the HTML format will work just fine.
0
Comment
Question by:cgooden01
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 44

Accepted Solution

by:
Rainer Jeschor earned 250 total points
ID: 39808583
Hi,
CSV format does not really make sense, as you have both different column count as well as column content.

And here the adjusted combination of both:
<#
	.SYNOPSIS
		Windows Machine Inventory Using PowerShell.

	.DESCRIPTION
		This script is to document the Windows machine. This script will work only for Local Machine.

	.EXAMPLE
		PS C:\> .\System_Inventory.PS1

	.OUTPUTS
		HTML File OutPut ReportDate , General Information , BIOS Information etc.

#>

Set-ExecutionPolicy RemoteSigned -ErrorAction SilentlyContinue

$UserName = (Get-Item  env:\username).Value 
$ComputerName = (Get-Item env:\Computername).Value
$filepath = (Get-ChildItem env:\userprofile).value


Add-Content  "$Filepath\style.CSS"  -Value " body {
font-family:Calibri;
 font-size:10pt;
background-image:url('C:\Images\CookieAuth.jpg'); 
}
th { 
background-color:black;

color:white;
}
td {
 background-color:#19fff0;
color:black;
}"

Write-Host "CSS File Created Successfully... Executing Inventory Report!!! Please Wait !!!" -ForegroundColor Yellow 
#ReportDate
$ReportDate = Get-Date | Select -Property DateTime |ConvertTo-Html -Fragment

#General Information
$ComputerSystem = Get-WmiObject -Class Win32_ComputerSystem | 
Select -Property Model , Manufacturer , Description , PrimaryOwnerName , SystemType |ConvertTo-Html -Fragment

#Boot Configuration
$BootConfiguration = Get-WmiObject -Class Win32_BootConfiguration |
Select -Property Name , ConfigurationPath | ConvertTo-Html -Fragment 

#BIOS Information
$BIOS = Get-WmiObject -Class Win32_BIOS | Select -Property PSComputerName , Manufacturer , Version | ConvertTo-Html -Fragment

#Operating System Information
$OS = Get-WmiObject -Class Win32_OperatingSystem | Select -Property Caption , CSDVersion , OSArchitecture , OSLanguage | ConvertTo-Html -Fragment

#Time Zone Information
$TimeZone = Get-WmiObject -Class Win32_TimeZone | Select Caption , StandardName |
ConvertTo-Html -Fragment

#Logical Disk Information
$Disk = Get-WmiObject -Class Win32_LogicalDisk -Filter DriveType=3 | 
Select SystemName , DeviceID , @{Name=”size(GB)”;Expression={“{0:N1}” -f($_.size/1gb)}}, @{Name=”freespace(GB)”;Expression={“{0:N1}” -f($_.freespace/1gb)}} |
ConvertTo-Html -Fragment

#CPU Information
$SystemProcessor = Get-WmiObject -Class Win32_Processor  | 
Select SystemName , Name , MaxClockSpeed , Manufacturer , status |ConvertTo-Html -Fragment

#Memory Information
$PhysicalMemory = Get-WmiObject -Class Win32_PhysicalMemory |
Select -Property Tag , SerialNumber , PartNumber , Manufacturer , DeviceLocator , @{Name="Capacity(GB)";Expression={"{0:N1}" -f ($_.Capacity/1GB)}} | ConvertTo-Html -Fragment

#Software Inventory
$Software = Get-WmiObject -Class Win32_Product |
Select Name , Vendor , Version , Caption | ConvertTo-Html -Fragment 

#Network Card
$nwINFO = Get-WmiObject -Class Win32_NetworkAdapterConfiguration | 
Where-Object { $_.IPAddress -ne $null } | 
Select -Property DNSHostName,Description,
    @{Name='IpAddress';Expression={$_.IpAddress -join '; '}}, 
    @{Name='IpSubnet';Expression={$_.IpSubnet -join '; '}}, 
    @{Name='DefaultIPgateway';Expression={$_.DefaultIPgateway -join '; '}}, 
    @{Name='DNSServerSearchOrder';Expression={$_.DNSServerSearchOrder -join '; '}},
    MACAddress  | ConvertTo-Html -Fragment 

ConvertTo-Html -Body "<font color = blue><H4><B>Report Executed On</B></H4></font>$ReportDate
<font color = blue><H4><B>General Information</B></H4></font>$ComputerSystem
<font color = blue><H4><B>Boot Configuration</B></H4></font>$BootConfiguration
<font color = blue><H4><B>BIOS Information</B></H4></font>$BIOS
<font color = blue><H4><B>Operating System Information</B></H4></font>$OS
<font color = blue><H4><B>Time Zone Information</B></H4></font>$TimeZone
<font color = blue><H4><B>Disk Information</B></H4></font>$Disk
<font color = blue><H4><B>Processor Information</B></H4></font>$SystemProcessor
<font color = blue><H4><B>Memory Information</B></H4></font>$PhysicalMemory
<font color = blue><H4><B>Software Inventory</B></H4></font>$Software 
<font color = blue><H4><B>Network Card Information</B></H4></font>$nwINFO" -CssUri  "$filepath\style.CSS" -Title "Server Inventory" | Out-File "$FilePath\$ComputerName.html"

Write-Host "Script Execution Completed" -ForegroundColor Yellow
Invoke-Item -Path "$FilePath\$ComputerName.html"

Open in new window


HTH
Rainer
0

Featured Post

Is Your Team Achieving Their Full Potential?

74% of employees feel they are not achieving their full potential. With Linux Academy, not only will you strengthen your team's core competencies but also their knowledge of of the newest IT topics.

With new material every week, we'll make sure that you stay ahead of the game.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Recently we ran in to an issue while running some SQL jobs where we were trying to process the cubes.  We got an error saying failure stating 'NT SERVICE\SQLSERVERAGENT does not have access to Analysis Services. So this is a way to automate that wit…
In this post we will be converting StringData saved within a text file into a hash table. This can be further used in a PowerShell script for replacing settings that are dynamic in nature from environment to environment.
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

717 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question