System Administration Solution

Posted by Programming Help
4
Dec 9, 2016
106 Views

Below script will list the inventory which can be upgraded to Windows 8

 

<#

            .SYNOPSIS

                         Assets Inventory Using PowerShell.

           

            .EXAMPLE

                        PS C:\> .\Assets_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

 

Read more about Computer Programming Assignment Help

 

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!!! hold on !!!" -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

 

Read more about Computer Network Assignment Help

 

#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

 

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" -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"

 Below script will list the inventory which cannot be upgraded to Windows 8

 # Shows details of currently running PC

$computerSystem = Get-CimInstance CIM_ComputerSystem

$computerBIOS = Get-CimInstance CIM_BIOSElement

$computerOS = Get-CimInstance CIM_OperatingSystem

$computerCPU = Get-CimInstance CIM_Processor

$computerHDD = Get-CimInstance Win32_LogicalDisk -Filter "DeviceID = 'C:'"

Clear-Host

 

Write-Host "System Information for: " $computerSystem.Name -BackgroundColor DarkCyan

"Manufacturer: " + $computerSystem.Manufacturer

"Model: " + $computerSystem.Model

"Serial Number: " + $computerBIOS.SerialNumber

"CPU: " + $computerCPU.Name

"HDD Capacity: "  + "{0:N2}" -f ($computerHDD.Size/1GB) + "GB"

"HDD Space: " + "{0:P2}" -f ($computerHDD.FreeSpace/$computerHDD.Size) + " Free (" + "{0:N2}" -f ($computerHDD.FreeSpace/1GB) + "GB)"

"RAM: " + "{0:N2}" -f ($computerSystem.TotalPhysicalMemory/1GB) + "GB"

"Operating System: " + $computerOS.caption + ", Service Pack: " + $computerOS.ServicePackMajorVersion

"User logged In: " + $computerSystem.UserName

"Last Reboot: " + $computerOS.LastBootUpTime

 

 

Below is the output format of above script:

 

Manufacturer

Model

Serial Number

CPU

HDD Capacity/Free space

OS incl. Service Pack

RAM

Last reboot

 

 

Programming Assignments Help is the best assignment help provider in the United Kingdom. Our online assignment writing help UK is especially dedicated for the students studying in all UK colleges and universities. Submit assignment to get the best quality assignment help.

 

Comments
avatar
Please sign in to add comment.