Skip to content

Commit

Permalink
Merge pull request #16 from AsBuiltReport/dev
Browse files Browse the repository at this point in the history
v0.5.1 public release
  • Loading branch information
rebelinux committed May 16, 2023
2 parents 5be017f + 4bea7df commit d96eeac
Show file tree
Hide file tree
Showing 19 changed files with 74 additions and 79 deletions.
21 changes: 21 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
debug.log
.gitignore
# Created by https://www.toptal.com/developers/gitignore/api/powershell
# Edit at https://www.toptal.com/developers/gitignore?templates=powershell

### PowerShell ###
# Exclude packaged modules
*.zip

# Exclude .NET assemblies from source
*.dll

# End of https://www.toptal.com/developers/gitignore/api/powershell

### vscode ###
.vscode/tasks.json
.vscode/launch.json
.vscode/extensions.json
*.code-workspace

# End of https://www.toptal.com/developers/gitignore/api/hugo,vscode
4 changes: 2 additions & 2 deletions AsBuiltReport.Microsoft.Windows.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
RootModule = 'AsBuiltReport.Microsoft.Windows.psm1'

# Version number of this module.
ModuleVersion = '0.5.0'
ModuleVersion = '0.5.1'

# Supported PSEditions
# CompatiblePSEditions = @()
Expand All @@ -27,7 +27,7 @@ Author = 'Andrew Ramsay'
# CompanyName = 'Unknown'

# Copyright statement for this module
Copyright = '(c) 2022 Andrew Ramsay. All rights reserved.'
Copyright = '(c) 2023 Andrew Ramsay. All rights reserved.'

# Description of the functionality provided by this module
Description = 'A PowerShell module to generate an as built report on the configuration of Microsoft Windows.'
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# :arrows_counterclockwise: Microsoft Windows As Built Report Changelog

## [0.5.1] - 2023-05-16

### Added

- Added Hyper-V per VM configuration reporting @oolejniczak
- Added Hyper-V Management OS Adapters table @rebelinux

## [0.5.0] - 2023-05-08

### Added
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ PowerShell 5.1 and the following PowerShell modules are required for generating
- [Hyper-V Module](https://docs.microsoft.com/en-us/powershell/module/hyper-v/?view=windowsserver2022-ps)
- [DhcpServer Module](https://docs.microsoft.com/en-us/powershell/module/dhcpserver/?view=windowsserver2019-ps)
- [DnsServer Module](https://docs.microsoft.com/en-us/powershell/module/dnsserver/?view=windowsserver2019-ps)
- [FailoverClusters Module](https://learn.microsoft.com/en-us/powershell/module/failoverclusters/?view=windowsserver2022-ps)

### Linux & macOS

Expand Down Expand Up @@ -105,7 +106,7 @@ Install-WindowsFeature -Name RSAT-Clustering-PowerShell
```

### PowerShell v5.x running on Windows client computer
### PowerShell v5.x running on Windows client computer (Target)
<!-- ********** Add installation for any additional PowerShell module(s) ********** -->
```powershell
Install-Module AsBuiltReport.Microsoft.Windows
Expand Down
1 change: 1 addition & 0 deletions Src/Private/Get-AbrWinHostHWSummary.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ function Get-AbrWinHostHWSummary {
try {
Section -Style Heading2 'Host Hardware Settings' {
Paragraph 'The following section details hardware settings for the host'
BlankLine
$HostHardware = [PSCustomObject] @{
'Manufacturer' = $HostComputer.Manufacturer
'Model' = $HostComputer.Model
Expand Down
2 changes: 1 addition & 1 deletion Src/Private/Get-AbrWinHostStorageMPIO.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ function Get-AbrWinHostStorageMPIO
$MpioAutoClaim = Invoke-Command -Session $TempPssSession -ScriptBlock { Get-MSDSMAutomaticClaimSettings | Select-Object -ExpandProperty Keys }
if ($MpioAutoClaim) {
Section -Style Heading4 'Multipath I/O AutoClaim' {
Paragraph 'The Following table details the BUS types MPIO will automatically claim for'
Paragraph 'The following table details the BUS types MPIO will automatically claim for'
Blankline
$MpioAutoClaimReport = @()
foreach ($key in $MpioAutoClaim) {
Expand Down
66 changes: 29 additions & 37 deletions Src/Private/Get-AbrWinHyperVHostVM.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -26,23 +26,19 @@ function Get-AbrWinHyperVHostVM {

process {
if ($InfoLevel.HyperV -ge 1) {
$Vms = Get-VM -CimSession $TempCimSession
#$Vms = Get-VM -CimSession $TempCimSession
$global:Vms = Invoke-Command -Session $TempPssSession { Get-VM }
if ($Vms) {
try {
Section -Style Heading2 'Hyper-V VMs' {
Section -Style Heading3 'Hyper-V VMs' {
Paragraph 'The following section details the Hyper-V VMs running on this host'
Blankline
$VmSummary = @()
foreach ($Vm in $Vms) {
try {
$TempVmSummary = [PSCustomObject]@{
'VM Name' = $Vm.Name
'vCPU Count' = $Vm.ProcessorCount
'Memory (GB)' = [Math]::Round($Vm.MemoryAssigned / 1gb)
'Memory Type' = $Vm.DynamicMemoryEnabled
'Generation' = $Vm.Generation
'Version' = $Vm.Version
'Numa Aligned' = $Vm.NumaAligned
'State' = $Vm.State
}
$VmSummary += $TempVmSummary
}
Expand All @@ -61,30 +57,30 @@ function Get-AbrWinHyperVHostVM {
$VmSummary | Sort-Object 'VM Name' | Table @TableParams
foreach ($Vm in $Vms) {
try {
Section -Style Heading3 ($Vm.Name) {
Section -Style Heading4 ($Vm.Name) {
Paragraph 'The following sections detail the VM configuration settings'
Blankline
try {
Section -Style Heading4 'Virtual Machine Configuration' {
Blankline
Section -ExcludeFromTOC -Style NOTOCHeading5 'Virtual Machine Configuration' {
$DVDDrives = Invoke-Command -Session $TempPssSession -ScriptBlock{ Get-VMDvdDrive -VMName ($using:Vm).Name}
$VmConfiguration = [PSCustomObject]@{
'VM id' = $Vm.VMid
'VM Path' = $Vm.Path
'Uptime' = $Vm.Uptime
'vCPU Count' = $Vm.ProcessorCount
'Memory Assigned (GB)' = [Math]::Round($Vm.MemoryAssigned / 1gb)
'Dynamic Memory Enabled' = $Vm.DynamicMemoryEnabled
'Dynamic Memory Enabled' = ConvertTo-TextYN $Vm.DynamicMemoryEnabled
'Memory Startup (GB)' = [Math]::Round($Vm.MemoryStartup / 1gb)
'Memory Minimum (GB)' = [Math]::Round($Vm.MemoryMinimum / 1gb)
'Memory Maximum (GB)' = [Math]::Round($Vm.MemoryMaximum / 1gb)
'Numa Aligned' = $Vm.NumaAligned
'Numa Aligned' = ConvertTo-EmptyToFiller $Vm.NumaAligned
'Nuber of Numa Nodes' = $Vm.NumaNodesCount
'Number of Numa Sockets' = $Vm.NumaSocketCount
'Check Point Type' = $Vm.CheckpointType
'Parent Snapshot Id' = $Vm.ParentSnapshotId
'Parent Snapshot Name' = $Vm.ParentSnapshotName
'Parent Snapshot Id' = ConvertTo-EmptyToFiller $Vm.ParentSnapshotId
'Parent Snapshot Name' = ConvertTo-EmptyToFiller $Vm.ParentSnapshotName
'Generation' = $Vm.Generation
'DVD Drives' = $Vm.DVDDrives -Join ","
'DVD Drives' = $DVDDrives | ForEach-Object {"Controller Type: $($_.ControllerType), Media Type: $($_.DvdMediaType), Path: $($_.Path)"}
}
$TableParams = @{
Name = "Virtual Machines"
Expand All @@ -101,16 +97,15 @@ function Get-AbrWinHyperVHostVM {
Write-PscriboMessage -IsWarning $_.Exception.Message
}
try {
Section -Style Heading4 'Virtual Machine Guest Integration Service' {
Paragraph 'The following section details the status of Integration Services'
Blankline
Section -ExcludeFromTOC -Style NOTOCHeading5 'Virtual Machine Guest Integration Service' {
$VmIntegrationServiceSummary = @()
Foreach ($Service in ($Vm.VMIntegrationService)) {
$VMIntegrationService = Invoke-Command -Session $TempPssSession -ScriptBlock{ Get-VMIntegrationService -VMName ($using:Vm).Name}
Foreach ($Service in $VMIntegrationService) {
try {
$TempVmIntegrationServiceSummary = [PSCustomObject]@{
'Service Name' = $Service.Name
'Service State' = $Service.Enabled
'Primary Status' = $Service.PrimaryStatusDescription
'Service State' = ConvertTo-TextYN $Service.Enabled
'Primary Status' = ConvertTo-EmptyToFiller $Service.PrimaryStatusDescription
}
$VmIntegrationServiceSummary += $TempVmIntegrationServiceSummary
}
Expand All @@ -133,18 +128,17 @@ function Get-AbrWinHyperVHostVM {
Write-PscriboMessage -IsWarning $_.Exception.Message
}
try {
$VmNetworkAdapters = Get-VMNetworkAdapter -CimSession $TempCimSession -VMName $VM.Name
#$VmNetworkAdapters = Get-VMNetworkAdapter -CimSession $TempCimSession -VMName $VM.Name
$VmNetworkAdapters = Invoke-Command -Session $TempPssSession -ScriptBlock{ Get-VMNetworkAdapter -VMName ($using:Vm).Name }
if ($VmNetworkAdapters) {
Section -Style Heading4 'VM Network Adapters' {
Paragraph 'The following table details the network adapter details'
BlankLine
Section -ExcludeFromTOC -Style NOTOCHeading5 'VM Network Adapters' {
$VmNetworkAdapterReport = @()
ForEach ($Adapter in $VmNetworkAdapters) {
try {
$TempVmNetworkAdapter = [PSCustomObject]@{
'Name' = $Adapter.Name
'Mac Address' = $Adapter.MacAddress
'IP Address' = $Adapter.IPAddresses[0]
'IP Address' = ConvertTo-EmptyToFiller ($Adapter.IPAddresses)
'Switch Name' = $Adapter.SwitchName
}
$VmNetworkAdapterReport += $TempVmNetworkAdapter
Expand All @@ -170,11 +164,10 @@ function Get-AbrWinHyperVHostVM {
Write-PscriboMessage -IsWarning $_.Exception.Message
}
try {
$VmAdapterVlan = Get-VMNetworkAdapterVlan -CimSession $TempCimSession -VMName $VM.Name
#$VmAdapterVlan = Get-VMNetworkAdapterVlan -CimSession $TempCimSession -VMName $VM.Name
$VmAdapterVlan = Invoke-Command -Session $TempPssSession -ScriptBlock{ Get-VMNetworkAdapterVlan -VMName ($using:Vm).Name | Select-Object -Property * }
if ($VmAdapterVlan) {
Section -Style Heading4 'VM Network Adpater VLANs' {
Paragraph 'The following section details the VLAN configuration of VM Network Adapters'
BlankLine
Section -ExcludeFromTOC -Style NOTOCHeading5 'VM Network Adapter VLANs' {
$VmAdapterVlanReport = @()
ForEach ($Adapter in $VmAdapterVlan) {
try {
Expand Down Expand Up @@ -207,15 +200,14 @@ function Get-AbrWinHyperVHostVM {
Write-PscriboMessage -IsWarning $_.Exception.Message
}
try {
$VmHardDisks = Get-VMHardDiskDrive -CimSession $TempCimSession -VMName $VM.Name
#$VmHardDisks = Get-VMHardDiskDrive -CimSession $TempCimSession -VMName $VM.Name
$VmHardDisks =Invoke-Command -Session $TempPssSession -ScriptBlock{ Get-VMHardDiskDrive -VMName ($using:Vm).Name }
if ($VmHardDisks) {
Section -Style Heading4 'VM Hard Disks' {
Paragraph 'The following table details the VM hard disks'
BlankLine
Section -ExcludeFromTOC -Style NOTOCHeading5 'VM Hard Disks' {
$VmDiskReport = @()
foreach ($VmHardDisk in $VMHardDisks) {
try {
$VmVhd = Get-VHD -CimSession $TempCimSession -Path $VmHardDisk.Path
$VmVhd = Invoke-Command -Session $TempPssSession -ScriptBlock{ Get-VHD -Path ($using:VmHardDisk).Path }
$TempVmDiskReport = [PSCustomObject]@{
'Disk Path' = $VmVhd.Path
'Disk Format' = $VmVhd.VhdFormat
Expand Down Expand Up @@ -264,4 +256,4 @@ function Get-AbrWinHyperVHostVM {
}

end {}
}
}
Loading

0 comments on commit d96eeac

Please sign in to comment.