Quantcast
Channel: VMware Communities : All Content - All Communities
Viewing all articles
Browse latest Browse all 179681

HW Version Report

$
0
0

I have been running this report for sometime to check the hardware version and I just adjusted it to detect version 15 and now I get reports of UNKNOWN.  Is there a new setting I need to be looking for?

 

#############################

#    Connect to vCenter     #

#############################

Import-Module -Name VMware.PowerCLI

Set-PowerCLIConfiguration -DisplayDeprecationWarnings $false -InvalidCertificateAction ignore -confirm:$false

$vc = 'FQDN Name'

$Cred = Import-Clixml C:\util\Scripts\creds\autoitjob2.xml

 

Connect-VIServer $VC -Credential $Cred

 

#############################

#         Variables         #

#############################

$date=Get-Date -format "yyyy-MMM-d"

$datetime=Get-Date

$filelocation="C:\util\Scripts\Temp\HV-$date.htm"

 

$report = Get-VM | where { $_.Version -notmatch "v15" } | Select Name, Version

 

#############################

# Add Text to the HTML file #

#############################

$report | ConvertTo-Html –title "VMware Hardware Version" –body "<H1>VMware Hardware Version</H1>" -head "<link rel='stylesheet' href='style.css' type='text/css' />" | Out-File $filelocation

ConvertTo-Html –title "VMware Hardware Version" –body "<H4>Date and time</H4>",$datetime -head "<link rel='stylesheet' href='style.css' type='text/css' />" | Out-File -Append $filelocation

ConvertTo-Html –title "VMware Hardware Version" –body "<H4>VM Count</H4>",$report.Count -head "<link rel='stylesheet' href='style.css' type='text/css' />" | Out-File -Append $filelocation

 

######################

# FTP HTML output #

#####################

 

#we specify the directory where all files that we want to upload 

$Dir="$filelocation"

 

#ftp server

$ftp = "ftp://IP/internal-backups/datacenter/vcenter/misc-reports/HW/"

$user = "internal-ftp-backup"

$pass = "PW" 

 

$webclient = New-Object System.Net.WebClient

 

$webclient.Credentials = New-Object System.Net.NetworkCredential($user,$pass) 

 

#list every sql server trace file

foreach($item in (dir $Dir "*.bak")){

    "Uploading $item..."

    $uri = New-Object System.Uri($ftp+$item.Name)

    $webclient.UploadFile($uri, $item.FullName)

}

 

##############################

# Disconnect session from VC #

##############################

disconnect-viserver -confirm:$false


Viewing all articles
Browse latest Browse all 179681

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>