63 lines
3.2 KiB
PowerShell
63 lines
3.2 KiB
PowerShell
<#
|
|
.SYNOPSIS
|
|
A short one-line action-based description, e.g. 'Tests if a function is valid'
|
|
.DESCRIPTION
|
|
A longer description of the function, its purpose, common use cases, etc.
|
|
.NOTES
|
|
Information or caveats about the function e.g. 'This function is not supported in Linux'
|
|
.LINK
|
|
Specify a URI to a help page, this will show when Get-Help -Online is used.
|
|
.EXAMPLE
|
|
Test-MyTestFunction -Verbose
|
|
Explanation of the function or its result. You can include multiple examples with additional .EXAMPLE lines
|
|
#>
|
|
|
|
function Get-ITDVMwareVMHardening {
|
|
[CmdletBinding()]
|
|
param(
|
|
[string]
|
|
$Name
|
|
)
|
|
Begin {
|
|
|
|
}
|
|
Process {
|
|
$SettingName = @(
|
|
"tools.setInfo.sizeLimit",
|
|
"isolation.device.edit.disable",
|
|
"isolation.device.connectable.disable",
|
|
"isolation.tools.copy.disable",
|
|
"isolation.tools.dnd.disable",
|
|
"isolation.tools.setGUIOptions.enable",
|
|
"isolation.tools.paste.disable",
|
|
"isolation.tools.diskShrink.disable",
|
|
"isolation.tools.diskWiper.disable",
|
|
"log.keepOld",
|
|
"log.rotateSize"
|
|
)
|
|
$Result = [System.Collections.ArrayList]@()
|
|
ForEach ($n in $Name) {
|
|
$VM = Get-VM -Name $n | Where-Object { $_.ExtensionData.Summary.Config.ManagedBy.Type -ne "placeholderVm" }
|
|
$GetAdvSetting = Get-AdvancedSetting -Entity $VM -Name $SettingName | select Entity, Name, Value
|
|
$obj = [PSCustomObject]@{
|
|
'Entity' = $VM.Name
|
|
'Uid' = $VM.Uid.split('@')[1].split(':')[0]
|
|
"tools.setInfo.sizeLimit" = ($GetAdvSetting | Where-Object Name -EQ 'tools.setInfo.sizeLimit').Value
|
|
"isolation.device.edit.disable" = ($GetAdvSetting | Where-Object Name -EQ 'isolation.device.edit.disable').Value
|
|
"isolation.device.connectable.disable" = ($GetAdvSetting | Where-Object Name -EQ 'isolation.device.connectable.disable').Value
|
|
"isolation.tools.copy.disable" = ($GetAdvSetting | Where-Object Name -EQ 'isolation.tools.copy.disable').Value
|
|
"isolation.tools.dnd.disable" = ($GetAdvSetting | Where-Object Name -EQ 'isolation.tools.dnd.disable').Value
|
|
"isolation.tools.setGUIOptions.enable" = ($GetAdvSetting | Where-Object Name -EQ 'isolation.tools.setGUIOptions.enable').Value
|
|
"isolation.tools.paste.disable" = ($GetAdvSetting | Where-Object Name -EQ 'isolation.tools.paste.disable').Value
|
|
"isolation.tools.diskShrink.disable" = ($GetAdvSetting | Where-Object Name -EQ 'isolation.tools.diskShrink.disable').Value
|
|
"isolation.tools.diskWiper.disable" = ($GetAdvSetting | Where-Object Name -EQ 'isolation.tools.diskWiper.disable').Value
|
|
"log.keepOld" = ($GetAdvSetting | Where-Object Name -EQ 'log.keepOld').Value
|
|
"log.rotateSize" = ($GetAdvSetting | Where-Object Name -EQ 'log.rotateSize').Value
|
|
}
|
|
$Result.Add($obj)
|
|
}
|
|
}
|
|
End {
|
|
Write-Output $Result
|
|
}
|
|
} |