VMWARE hardening and powerCLI

I need to configu the host or the VMs on the host as follows:

Anyone have a powerCLI or script to complete this, as we have hundreds of VMS to do individually

Thanks for your help in advance


Verify DiskShrink Is Disabled
Verify DiskWiper Is Disabled
Verify MAC Address Changes Is Set to Reject
The ESXi Host Firewall Must Be Configured to Restrict Access to Services Running on the Host
Disable VM to VM Communication through VMCI
Verify That Floppy Devices Are Not Present
Verify That CD-ROMs Are Not Present
Verify That Parallel Ports Are Not Present
Verify That Serial Ports Are Not Present
Verify That a USB Controller Is Not Present
turn off copy between guest os and remote console
vmware tools auto upgrade
Verify That Paste Is Disabled between Guest OS and Remote Console
Verify Option to Override VMware Tools Settings Is Disabled
Prevent Others Users from Spying on Administrator Remote Consoles
Verify That the Number of Log Files to Keep Is Equal to 10
Verify That Log Rotate Size for Virtual Machines Is Less than or Equal to 100KB
Prevent Unauthorized Connection or Removal of Devices
Prevent Unauthorized Modification of Devices
Do Not Send Host Performance Information to Guests
Control Access to VMs through VMsafe CPU/Mem API
Verify Promiscuous Mode Is Set to Reject
The System Must Be Configured with a Default Gateway for IPv4
The IPv6 Protocol Handler Must Not Be Installed
The DHCP Client Must Be Disabled
Ensure That NTP Is Running
NTP Time Synchronization Must Be Configured
Configure Remote Logging for ESXi Hosts
Disable DCUI to Prevent Local Administrative Control
Disable Esxi Shell Unless Needed for Diagnostics or Troubleshooting
Disable SSH
Verify That Lockdown Mode Is Enabled
Verify That isolation.tools.getCreds.disable Is Set to True
Verify That isolation.tools.ghi.launchmenu.change Is Set to True
Verify That isolation.tools.memSchedFakeSampleStats.disable Is Set to True
Verify That isolation.tools.unity.push.update.disable Is Set to True
Verify Size of GuestInfo File Is Less than or Equal to 1MB
Using at Least Two DNS Servers
Prevent Unintended Use of VMsafe Network APIs
Set a Timeout for the Esxi Shell to Automatically Disabled Idle Sessions after a Predetermined Period
Active Directory "ESX Admin" Group Membership Must Be Verified
LVL 5
IndyrbAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

nbeutlerCommented:
That might not answer your questionbut i can recommend you to use the "Onyx Web Client"-fling that got recently released to get the settings ported to PowerCLI that are not documented online (yet).

Here is a really good video about how to get it rolling.

http://www.virtu-al.net/2015/07/20/creating-re-usable-powercli-functions-with-onyx-for-the-web-client/
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
IndyrbAuthor Commented:
does anyone have a powrshell\power cli for any of the items without adding the onyx web plugin?

even if each is in its own one liner
0
IndyrbAuthor Commented:
I created a csv as follows
Key,Value
isolation.tools.copy.disable,true
isolation.tools.dnd.disable,true
isolation.tools.paste.disable,true
isolation.tools.diskShrink.disable,true
isolation.tools.diskWiper.disable,true
vmci0.unrestricted,false
logging,false
isolation.tools.ghi.autologon.disable,true
isolation.bios.bbs.disable,true
isolation.tools.getCreds.disable,true
isolation.tools.ghi.launchmenu.change,true
isolation.tools.memSchedFakeSampleStats.disable,true
isolation.tools.ghi.protocolhandler.info.disable,true
isolation.ghi.host.shellAction.disable,true
isolation.tools.dispTopoRequest.disable,true
isolation.tools.trashFolderState.disable,true
isolation.tools.ghi.trayicon.disable,true
isolation.tools.unity.disable,true
isolation.tools.unityInterlockOperation.disable,true
isolation.tools.unity.taskbar.disable,true
isolation.tools.unityActive.disable,true
isolation.tools.unity.windowContents.disable,true
isolation.tools.unity.push.update.disable,true
isolation.tools.vmxDnDVersionGet.disable,true
isolation.tools.guestDnDVersionSet.disable,true
isolation.tools.vixMessage.disable,true
floppyX.present,false
parallelX.present,false
serialX.present,false
tools.setInfo.sizeLimit,1048576
RemoteDisplay.vnc.enabled,false
isolation.device.connectable.disable,true
RemoteDisplay.maxConnections,1
isolation.device.edit.disable,true
tools.guestlib.enableHostInfo,FALSE
vmsafe.enable,false
isolation.tools.copy.disable,true
isolation.tools.hgfsServerSet.disable,true
isolation.tools.connectable.disable,true
isolation.tools.setGUIOptions.Enable,false
log.keepOld,10
log.rotateSize,100000

Open in new window


Then a powershell script as follows that calls the csv file

####################################
# VMware VirtualCenter server name #
####################################
$vCenter = @(
"server1",
"server2",
"server3",
"server4"
);

##################
# Add VI-toolkit #
##################
Add-PSsnapin VMware.VimAutomation.Core
Initialize-VIToolkitEnvironment.ps1
Connect-VIServer -Server $vCenter


$import = Import-Csv "C:\Scripts\VMachine_config.csv"

$vms = Get-View -ViewType VirtualMachine | where {-not $_.config.template}

$vmConfigSpec = New-Object VMware.Vim.VirtualMachineConfigSpec

    foreach($item in $import){

        $extra = New-Object VMware.Vim.optionvalue
        $extra.Key=$item.Key
        $extra.Value=$item.Value
        $vmConfigSpec.extraconfig += $extra
    }

    foreach($vm in $vms){

        $vm.ReconfigVM($vmConfigSpec)
    }

Disconnect-VIServer –Confirm:$false

Open in new window


I still need powershell script for the ESX side though..

Ideas?
0
IndyrbAuthor Commented:
for removing snapshots I used
####################################
# VMware VirtualCenter server name #
####################################
$vCenter = @(
"server1",
"server2"
);

##################
# Add VI-toolkit #
##################
Add-PSsnapin VMware.VimAutomation.Core
Initialize-VIToolkitEnvironment.ps1
Connect-VIServer -Server $vCenter

$snap=get-snapshot -vm * ; remove-snapshot -snap $snap

Disconnect-VIServer –Confirm:$false

Open in new window


for removing CD-ROMs I used
####################################
# VMware VirtualCenter server name #
####################################
$vCenter = @(
"server1",
"server2"
);
##################
# Add VI-toolkit #
##################
Add-PSsnapin VMware.VimAutomation.Core
Initialize-VIToolkitEnvironment.ps1
Connect-VIServer -Server $vCenter

get-cddrive -VM *|where {$_ISOPATH -ne $null}|set-cddrive -nomedia


Disconnect-VIServer –Confirm:$false

Open in new window

0
IndyrbAuthor Commented:
This is what I have left to configure with Powershell or CLI on all hosts

Assistance would be greatly appreciated

Active Directory "ESX Admin" group membership must be verified
Configure Remote logging for ESXi Hosts
Disable DCUI to prevent local administrative control
Disable ESXi Shell unless needed for diagnostics or troubleshooting
Disable SSH
Ensure NTP is running with proper NTP settings
NTP Time Synchronization must be configuered
Prevent Unattended use of VMsafe Network APIS
Set a Timeout for ESXi shell to automatically Disable idle sessions after a predetermined time
The DHCP client must be disabled
The ESXi host firewall must be configured to restrict access to services running on the host
The IPv6 Protocol handler must not be installed
The system must be configured with a default gateway for IPv4
Use at least two DNS servers or set to the proper values
Verify MAC address changes is set to reject
Verify lockdown mode is enabled
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
VMware

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.