Skip to content

Commit

Permalink
Merge pull request #616 from alanrenouf/dev
Browse files Browse the repository at this point in the history
Merge dev to master - version 6.25
  • Loading branch information
Sneddo authored Dec 26, 2017
2 parents 01d5a9a + e8e1ca3 commit 281b5a7
Show file tree
Hide file tree
Showing 30 changed files with 13,312 additions and 1,448 deletions.
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ If the changes are related to an existing GitHub issue, please reference the iss
One of the easiest ways to contribute to a PowerShell project is by helping to write and edit documentation.
All of our documentation hosted on GitHub is written using [GitHub Flavored Markdown](https://help.github.com/articles/github-flavored-markdown/)

*We are at lest working on shifting things over to GFM, for 'core' documentation. Some things may still live on the GitHub wiki, but using GFM allows the documentation to exist in the repo, so you always have a local copy to reference ;)*
*We are at least working on shifting things over to GFM, for 'core' documentation. Some things may still live on the GitHub wiki, but using GFM allows the documentation to exist in the repo, so you always have a local copy to reference ;)*

To [edit an existing file](https://help.github.com/articles/editing-files-in-another-user-s-repository/), simply navigate to it and click the "Edit" button.
GitHub will automatically create your own fork of our repository where you can make your changes.
Expand Down Expand Up @@ -111,7 +111,7 @@ When contributing to this repository, please follow the following guidelines:

* For all indentation, use 4 spaces instead of tab stops
* Make sure all files are encoding using UTF-8.
* When writing Markdown, if a paragraph includes more than one setence, end each sentence with a newline.
* When writing Markdown, if a paragraph includes more than one sentence, end each sentence with a newline.
GitHub will still render the sentences as a single paragraph, but the readability of `git diff` will be greatly improved.


Expand Down
2 changes: 1 addition & 1 deletion GlobalVariables.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ $EmailReportEvenIfEmpty = $true
# If you would prefer the HTML file as an attachment then enable the following:
$SendAttachment = $false
# Set the style template to use.
$Style = "VMware"
$Style = "Clarity"
# Do you want to include plugin details in the report?
$reportOnPlugins = $true
# List Enabled plugins first in Plugin Report?
Expand Down
12 changes: 6 additions & 6 deletions Lang/en-GB/79 Find VMs in Uncontrolled Snapshot Mode.psd1
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# culture="en-US"
ConvertFrom-StringData @'
pluginActivity = Searching Datastores
pluginStatus = [{0} of {1}] {2}
Complete = completed
'@
# culture="en-US"
ConvertFrom-StringData @'
pluginActivity = Searching Datastores
pluginStatus = [{0} of {1}] {2}
Complete = completed
'@
72 changes: 36 additions & 36 deletions Lang/en-GB/vCheck.psd1
Original file line number Diff line number Diff line change
@@ -1,36 +1,36 @@
# culture="en-US"
ConvertFrom-StringData @'
setupMsg01 =
setupMsg02 = Welcome to vCheck by Virtu-Al http://virtu-al.net
setupMsg03 = =================================================
setupMsg04 = This is the first time you have run this script or you have re-enabled the setup wizard.
setupMsg05 =
setupMsg06 = To re-run this wizard in the future please use vCheck.ps1 -Config
setupMsg07 = To get usage information, please use Get-Help vCheck.ps1
setupMsg08 =
setupMsg09 = Please complete the following questions or hit Enter to accept the current setting
setupMsg10 = After completing this wizard the vCheck report will be displayed on the screen.
setupMsg11 =
configMsg01 = After you have exported the new settings from the configuration interface,
configMsg02 = import the settings CSV file using Import-vCheckSettings -csvfile C:\\path\\to\\vCheckSettings.csv
configMsg03 = NOTE: If vCheckSettings.csv is stored in the vCheck folder, simply run Import-vCheckSettings
resFileWarn = Image File not found for {0}!
pluginInvalid = Plugin does not exist: {0}
pluginpathInvalid = Plugin path "{0}" is invalid, defaulting to {1}
gvInvalid = Global Variables path invalid in job specification, defaulting to {0}
varUndefined = Variable `${0} is not defined in GlobalVariables.ps1
pluginActivity = Evaluating plugins
pluginStatus = [{0} of {1}] {2}
Complete = Complete
pluginBegin = \nBegin Plugin Processing
pluginStart = ..start calculating {0} by {1} v{2} [{3} of {4}]
pluginEnd = ..finished calculating {0} by {1} v{2} [{3} of {4}]
repTime = This report took {0} minutes to run all checks, completing on {1} at {2}
repPRTitle = Plugin Report
repTTRTitle = Time to Run
slowPlugins = The following plugins took longer than {0} seconds to run, there may be a way to optimize these or remove them if not needed
emailSend = ..Sending Email
emailAtch = vCheck attached to this email
HTMLdisp = ..Displaying HTML results
'@

# culture="en-US"
ConvertFrom-StringData @'
setupMsg01 =
setupMsg02 = Welcome to vCheck by Virtu-Al http://virtu-al.net
setupMsg03 = =================================================
setupMsg04 = This is the first time you have run this script or you have re-enabled the setup wizard.
setupMsg05 =
setupMsg06 = To re-run this wizard in the future please use vCheck.ps1 -Config
setupMsg07 = To get usage information, please use Get-Help vCheck.ps1
setupMsg08 =
setupMsg09 = Please complete the following questions or hit Enter to accept the current setting
setupMsg10 = After completing this wizard the vCheck report will be displayed on the screen.
setupMsg11 =
configMsg01 = After you have exported the new settings from the configuration interface,
configMsg02 = import the settings CSV file using Import-vCheckSettings -csvfile C:\\path\\to\\vCheckSettings.csv
configMsg03 = NOTE: If vCheckSettings.csv is stored in the vCheck folder, simply run Import-vCheckSettings
resFileWarn = Image File not found for {0}!
pluginInvalid = Plugin does not exist: {0}
pluginpathInvalid = Plugin path "{0}" is invalid, defaulting to {1}
gvInvalid = Global Variables path invalid in job specification, defaulting to {0}
varUndefined = Variable `${0} is not defined in GlobalVariables.ps1
pluginActivity = Evaluating plugins
pluginStatus = [{0} of {1}] {2}
Complete = Complete
pluginBegin = \nBegin Plugin Processing
pluginStart = ..start calculating {0} by {1} v{2} [{3} of {4}]
pluginEnd = ..finished calculating {0} by {1} v{2} [{3} of {4}]
repTime = This report took {0} minutes to run all checks, completing on {1} at {2}
repPRTitle = Plugin Report
repTTRTitle = Time to Run
slowPlugins = The following plugins took longer than {0} seconds to run, there may be a way to optimize these or remove them if not needed
emailSend = ..Sending Email
emailAtch = vCheck attached to this email
HTMLdisp = ..Displaying HTML results
'@

40 changes: 20 additions & 20 deletions Lang/en-US/00 Connection Plugin for vCenter.psd1
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
# culture="en-US"

ConvertFrom-StringData @'
connReuse = Re-using connection to VI Server
connOpen = Connecting to VI Server
connError = Unable to connect to vCenter, please ensure you have altered the vCenter server address correctly. To specify a username and password edit the connection string in the file $GlobalVariables
custAttr = Adding Custom properties
collectVM = Collecting VM Objects
collectHost = Collecting VM Host Objects
collectCluster = Collecting Cluster Objects
collectDatastore = Collecting Datastore Objects
collectDVM = Collecting Detailed VM Objects
collectTemplate = Collecting Template Objects
collectDVIO = Collecting Detailed VI Objects
collectAlarm = Collecting Detailed Alarm Objects
collectDHost = Collecting Detailed VMHost Objects
collectDCluster = Collecting Detailed Cluster Objects
collectDDatastore = Collecting Detailed Datastore Objects
collectDDatastoreCluster = Collecting Detailed Datastore Cluster Objects
collectAlarms = Collecting Alarm Definitions
# culture="en-US"

ConvertFrom-StringData @'
connReuse = Re-using connection to VI Server
connOpen = Connecting to VI Server
connError = Unable to connect to vCenter, please ensure you have altered the vCenter server address correctly. To specify a username and password edit the connection string in the file $GlobalVariables
custAttr = Adding Custom properties
collectVM = Collecting VM Objects
collectHost = Collecting VM Host Objects
collectCluster = Collecting Cluster Objects
collectDatastore = Collecting Datastore Objects
collectDVM = Collecting Detailed VM Objects
collectTemplate = Collecting Template Objects
collectDVIO = Collecting Detailed VI Objects
collectAlarm = Collecting Detailed Alarm Objects
collectDHost = Collecting Detailed VMHost Objects
collectDCluster = Collecting Detailed Cluster Objects
collectDDatastore = Collecting Detailed Datastore Objects
collectDDatastoreCluster = Collecting Detailed Datastore Cluster Objects
collectAlarms = Collecting Alarm Definitions
'@
15 changes: 9 additions & 6 deletions Plugins/00 Initialize/00 Connection Plugin for vCenter.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ switch ($platform.OSFamily) {
Get-Module -ListAvailable PowerCLI* | Import-Module
}
"Linux" {
$Outputpath = $templocation
$templocation = "/tmp"
$Outputpath = $templocation
Get-Module -ListAvailable PowerCLI* | Import-Module
}
"Windows" {
Expand Down Expand Up @@ -437,10 +437,10 @@ PS> Get-Datastore | Get-HttpDatastoreItem -Credential $cred -Recurse
[cmdletbinding()]
param(
[VMware.VimAutomation.ViCore.Types.V1.VIServer]$Server = $global:DefaultVIServer,
[parameter(Mandatory=$true,ValueFromPipelineByPropertyName,ParameterSetName=’Datastore’)]
[parameter(Mandatory=$true,ValueFromPipelineByPropertyName,ParameterSetName="Datastore")]
[Alias('Name')]
[string]$Datastore,
[parameter(Mandatory=$true,ParameterSetName=’Path’)]
[parameter(Mandatory=$true,ParameterSetName="Path")]
[string]$Path = '',
[PSCredential]$Credential,
[Switch]$Recurse = $false,
Expand Down Expand Up @@ -545,9 +545,12 @@ PS> Get-Datastore | Get-HttpDatastoreItem -Credential $cred -Recurse
$tSize = $_.Groups['Filesize'].Value
if($Unit.IsPresent){
$friendly = $tSize | Get-FriendlyUnit
$obj.Add('Size',[Math]::Round($friendly.Value,0)) $obj.Add('Unit',$friendly.Unit) }
$obj.Add('Size',[Math]::Round($friendly.Value,0))
$obj.Add('Unit',$friendly.Unit)
}
else{
$obj.Add('Size',$tSize) }
$obj.Add('Size',$tSize)
}
}
else{
$obj.Add('Size','')
Expand All @@ -572,4 +575,4 @@ PS> Get-Datastore | Get-HttpDatastoreItem -Credential $cred -Recurse
}
Write-Verbose -Message "$(Get-Date) $($s = Get-PSCallStack;"<Leaving {0}" -f $s[0].FunctionName)"
}
}
}
25 changes: 14 additions & 11 deletions Plugins/10 vCenter/82 License Report.ps1
Original file line number Diff line number Diff line change
@@ -1,23 +1,26 @@
$Title = "vCenter License Report"
$Header = "License Report"
$Comments = "The following displays licenses registered with this server and usage."
$Display = "Table"
$Author = "Justin Mercier"
$PluginVersion = 1.1
$PluginCategory = "vSphere"

# Start of Settings
# Display Eval licenses?
$licenseEvals = $true
# End of Settings

$vSphereLicInfo = @()

Foreach ($LicenseMan in Get-View ($ServiceInstance | Select-Object -First 1).Content.LicenseManager)
{
($LicenseMan | Select-Object -ExpandProperty Licenses) | Select-Object @{Name="VC";e={([Uri]$LicenseMan.Client.ServiceUrl).Host}}, `
($LicenseMan | Select-Object -ExpandProperty Licenses) | Where {$licenseEvals -or $_.Name -notmatch "Evaluation" } | Select-Object @{Name="VC";e={([Uri]$LicenseMan.Client.ServiceUrl).Host}}, `
Name, LicenseKey, Total, Used, @{Name="Information";e={$_.Labels | Select-Object -ExpandProperty Value}}, `
@{"Name"="ExpirationDate";e={$_.Properties | Where-Object { $_.key -eq "expirationDate" } | Select-Object -ExpandProperty Value}}
@{"Name"="ExpirationDate";e={$_.Properties | Where-Object { $_.key -eq "expirationDate" } | Select-Object -ExpandProperty Value}}
}

$Title = "vCenter License Report"
$Header = "License Report"
$Comments = "The following displays licenses registered with this server and usage. Include Evals: $licenseEvals"
$Display = "Table"
$Author = "Justin Mercier, Bill Wall"
$PluginVersion = 1.2
$PluginCategory = "vSphere"

# Changelog
## 1.0 : Initial Release
## 1.1 : Code refactor
## 1.1 : Code refactor
## 1.2 : Added the ability to exclude evaluation licenses, clean up whitespace (@thebillness)
29 changes: 29 additions & 0 deletions Plugins/30 Host/115 Host Multipath Policy.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
$Title = "Host Multipath Policy"
$Comments = "See the Storage/SAN section of the <a href='https://www.vmware.com/resources/compatibility/search.php?deviceCategory=san' target='_blank'>VMware Compatibility Guide</a> or your array/storage vendor's documentation for the supported/recommended policy."
$Display = "Table"
$Author = "Doug Taliaferro"
$PluginVersion = 1.0
$PluginCategory = "vSphere"

# Start of Settings
# The Multipath Policy (PSP Plugin) your hosts should be configured to use
$MultipathPolicy = "VMW_PSP_RR"
# End of Settings

# Update settings where there is an override
$MultipathPolicy = Get-vCheckSetting $Title "MultipathPolicy" $MultipathPolicy

$lunResults = @()
Foreach ($esxhost in ($HostsViews | Where-Object {$_.Runtime.ConnectionState -match "Connected|Maintenance"})) {
$esxhost | ForEach-Object {$_.config.storageDevice.multipathInfo.lun} | Where-Object {$_.path.count -gt 1 } | Where-Object {$_.policy.policy -ne $MultipathPolicy} | ForEach-Object {
$myObj = "" | Select-Object VMHost, LunID, Policy
$myObj.VMHost = $esxhost.Name
$myObj.LunID = $_.ID
$myObj.Policy = $_.Policy.policy
$lunResults += $myObj
}
}

$lunResults

$Header = "Hosts/LUNs not using Multipath Policy '$($MultipathPolicy)' : [count]"
28 changes: 28 additions & 0 deletions Plugins/30 Host/120 Power Management Policy.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
$Title = "Host Power Management Policy"
$Comments = "The following hosts are not using the specified power management policy. Power management may impact performance for latency sensitive workloads. For details see <a href='https://www.vmware.com/content/dam/digitalmarketing/vmware/en/pdf/techpaper/performance/Perf_Best_Practices_vSphere65.pdf' >Performance Best Practices for VMware vSphere 6.5</a>"
$Display = "Table"
$Author = "Doug Taliaferro"
$PluginVersion = 1.0
$PluginCategory = "vSphere"

# Start of Settings
# Which power management policy should your hosts use? For Balanced enter "dynamic" (this is the ESXi default policy), for High Performance enter "static", for Low power enter "low".
$PowerPolicy = "dynamic"
# End of Settings

# Update settings where there is an override
$PowerPolicy = Get-vCheckSetting $Title "PowerPolicy" $PowerPolicy

$hostResults = @()
Foreach ($esxhost in ($HostsViews | Where-Object {$_.Runtime.ConnectionState -match "Connected|Maintenance"})) {
If ($esxhost.config.PowerSystemInfo.CurrentPolicy.ShortName -ne $PowerPolicy) {
$myObj = "" | Select-Object VMHost, PowerPolicy
$myObj.VMHost = $esxhost.Name
$myObj.PowerPolicy = $esxhost.config.PowerSystemInfo.CurrentPolicy.ShortName
$hostResults += $myObj
}
}

$hostResults

$Header = "Hosts not using Power Mangement Policy '$($PowerPolicy)' : [count]"
74 changes: 74 additions & 0 deletions Plugins/30 Host/125 Host NFS Settings.ps1.disabled
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
$Title = "Host NFS Settings"
$Comments = "The following hosts may not have the recommended settings for NFS storage. See <a href='https://kb.vmware.com/s/article/2239' target='_blank'>VMware KB 2239</a> and your storage vendor's documentation for the recommended settings."
$Display = "Table"
$Author = "Doug Taliaferro"
$PluginVersion = 1.0
$PluginCategory = "vSphere"

# Create an object to store the settings - the property names match the ESXi advanced setting name so we
# can use them to get each setting from the host and compare them
$myObj = "" | Select-Object Misc.APDTimeout, NFS.HeartbeatTimeout, NFS.SendBufferSize, NFS.ReceiveBufferSize, NFS.MaxVolumes, `
Net.TcpipHeapMax, Net.TcpipHeapSize, NFS.HeartbeatFrequency, NFS.HeartbeatDelta, NFS.HeartbeatMaxFailures
# Start of Settings
# APD Timeout - default of 140 is usually recommended (consult with your storage vendor)
$myObj.'Misc.APDTimeout' = "140"
# NFS Heartbeat Timeout - default of 5 is usually recommended (consult with your storage vendor)
$myObj.'NFS.HeartbeatTimeout' = "5"
# NFS Send Buffer Size - default of 264 is usually recommended (consult with your storage vendor)
$myObj.'NFS.SendBufferSize' = "264"
# NFS Receive Buffer Size - default of 256 is usually recommended (consult with your storage vendor)
$myObj.'NFS.ReceiveBufferSize' = "256"
# NFS Max Volumes - ESXi host default is 8, but 256 is often recommended (see VMware KB 2239)
$myObj.'NFS.MaxVolumes' = "256"
# Net TCPIP Heap Max - for ESXi 6.x this can be increased to '1536' (see VMware KB 2239)
$myObj.'Net.TcpipHeapMax' = "512"
# Net TCPIP Heap Size - ESXi host default is 0, but 32 is often recommended (see VMware KB 2239)
$myObj.'Net.TcpipHeapSize' = "32"
# NFS Heartbeat Frequency - default of 12 is usually recommended (consult with your storage vendor)
$myObj.'NFS.HeartbeatFrequency' = "12"
# NFS Heartbeat Delta - default of 5 is usually recommended (consult with your storage vendor)
$myObj.'NFS.HeartbeatDelta' = "5"
# NFS Heartbeat Max Failures - default of 10 is usually recommended (consult with your storage vendor)
$myObj.'NFS.HeartbeatMaxFailures' = "10"
# End of Settings

$hostResults = @()
Foreach ($esxhost in ($HostsViews | Where-Object {$_.Runtime.ConnectionState -match "Connected|Maintenance"})) {

# Create an object to store the host settings
$hostObj = New-Object Object
# Iterate through each property in the custom object containing the settings
$myObj.psobject.Properties | % {
$PropertyName = $_.Name
$hostObj | Add-Member -MemberType NoteProperty -Name $PropertyName -Value ($esxhost.Config.Option | Where-Object { $_.Key -eq $PropertyName }).Value
}

# Compare the two objects for differences
If ((Compare-Object ($hostObj | Out-String -Stream) ($myObj | Out-String -Stream)).count -gt 0) {
# If they don't match, create a final object that includes the host name
$finalObj = New-Object Object
$finalObj | Add-Member -MemberType NoteProperty -Name VMHost -Value $esxhost.Name
Foreach ( $Property in $hostObj.psobject.Properties){
$finalObj | Add-Member -MemberType NoteProperty -Name $Property.Name -Value $Property.value
}
$hostResults += $finalObj
}
}

# If there are results, create a header row to show the plugin settings in the report
if ($hostResults.Count -gt 0) {
$headObj = New-Object Object
$headObj | Add-Member -MemberType NoteProperty -Name VMHost -Value "Plugin Settings"
foreach ( $Property in $myObj.psobject.Properties){
$headObj | Add-Member -MemberType NoteProperty -Name $Property.Name -Value $Property.value
}
$hostResults = ,$headObj + $hostResults
}
$hostResults

$Header = "Host NFS settings that don't match : [count]"
# Table formatting - highlight cells without matching settings
$TableFormat = @{}
foreach ($Property in $myObj.psObject.Properties) {
$TableFormat += @{"$($Property.Name)" = @(@{"-ne $($Property.Value)" = "Cell,class|critical"; })}
}
12 changes: 12 additions & 0 deletions Plugins/30 Host/130 Eval License Key.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
$Title = "Eval License Keys"
$Header = "Hosts using an Evaluation Key : [count]"
$Comments = "The following hosts are using an evaluation key that will expire, causing them to disconnect from vCenter."
$Display = "Table"
$Author = "Doug Taliaferro"
$PluginVersion = 1.0
$PluginCategory = "vSphere"

# Start of Settings
# End of Settings

$VMH | where-object {($_.ConnectionState -match "Connected|Maintenance") -and ($_.LicenseKey -eq "00000-00000-00000-00000-00000")} | Select Name, LicenseKey
Loading

0 comments on commit 281b5a7

Please sign in to comment.