Skip to content
LT edited this page Sep 15, 2025 · 5 revisions

vmware-cis-vm

🏢 VMware Solution Overview

Professional VMware vSphere automation, management tools, and learning resources for enterprise environments.

Solution Components

  • PowerCLI Scripts: Automated vSphere management
  • Configuration Templates: Best practice implementations
  • Monitoring Tools: Performance and health checks
  • Security Hardening: CIS benchmarks and STIG compliance
  • Learning Materials: Hands-on labs and documentation

🚀 Getting Started

Prerequisites

# Install PowerCLI
Install-Module -Name VMware.PowerCLI -Force -AllowClobber

# Set execution policy
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser

# Import modules
Import-Module VMware.PowerCLI

Environment Setup

# Clone repository
git clone https://github.com/uldyssian-sh/vmware-cis-vm.git
cd vmware-cis-vm

# Connect to vCenter
Connect-VIServer -Server vcenter.domain.com -User administrator@vsphere.local

# Verify connection
Get-VMHost | Select Name, ConnectionState, PowerState

📋 Core Features

Automation Scripts

  • VM Lifecycle Management: Creation, configuration, deletion
  • Resource Pool Management: CPU, memory, storage allocation
  • Network Configuration: vSwitches, port groups, VLANs
  • Storage Management: Datastores, VMFS, NFS configuration
  • Backup & Recovery: Snapshot management, replication

Security & Compliance

  • CIS Benchmarks: vSphere security hardening
  • STIG Compliance: DoD security requirements
  • Audit Scripts: Configuration validation
  • Vulnerability Assessment: Security posture evaluation

Performance Monitoring

# CPU utilization monitoring
Get-Stat -Entity (Get-VMHost) -Stat "cpu.usage.average" -Start (Get-Date).AddDays(-7)

# Memory usage analysis
Get-VM | Get-Stat -Stat "mem.usage.average" | Sort-Object Value -Descending

# Storage performance
Get-Datastore | Get-Stat -Stat "datastore.totalReadLatency.average"

🔧 Configuration Examples

VM Deployment Template

# Create new VM from template
$vmParams = @{
    Name = "WebServer-01"
    Template = "Windows2019-Template"
    VMHost = "esxi-host-01.domain.com"
    Datastore = "DataStore-SSD-01"
    ResourcePool = "Production"
}
New-VM @vmParams

# Configure VM resources
Set-VM -VM "WebServer-01" -MemoryGB 8 -NumCpu 4 -Confirm:$false

Network Configuration

# Create distributed port group
$vds = Get-VDSwitch -Name "Production-VDS"
New-VDPortgroup -VDSwitch $vds -Name "Web-Tier" -VlanId 100

# Configure VM network
Get-VM "WebServer-01" | Get-NetworkAdapter | Set-NetworkAdapter -Portgroup "Web-Tier" -Confirm:$false

Storage Management

# Create VMFS datastore
$vmhost = Get-VMHost "esxi-host-01.domain.com"
$lun = Get-ScsiLun -VMHost $vmhost -LunType disk | Where {/tmp/vmware-cis-vm-wiki.CanonicalName -like "*naa.600*"}
New-Datastore -VMHost $vmhost -Name "DataStore-Production" -Path $lun.CanonicalName -VMFS

🎓 Learning Path

Foundation Level (Weeks 1-4)

  1. vSphere Architecture: ESXi, vCenter, vSAN components
  2. Installation & Configuration: ESXi deployment, vCenter setup
  3. Virtual Machine Management: Creation, configuration, templates
  4. Basic Networking: Standard switches, port groups

Intermediate Level (Weeks 5-8)

  1. Advanced Networking: Distributed switches, VLANs, load balancing
  2. Storage Technologies: VMFS, NFS, vSAN, Storage Policies
  3. Resource Management: DRS, HA, vMotion, Storage vMotion
  4. Backup & Recovery: Snapshots, replication, disaster recovery

Advanced Level (Weeks 9-12)

  1. Automation: PowerCLI scripting, REST APIs, vRealize Orchestrator
  2. Security Hardening: CIS benchmarks, STIG compliance
  3. Performance Optimization: Monitoring, troubleshooting, tuning
  4. Integration: NSX, vRealize Suite, third-party tools

🔐 Security Best Practices

Access Control

# Create custom role
New-VIRole -Name "VM-Operator" -Privilege @("VirtualMachine.Interact.PowerOn", "VirtualMachine.Interact.PowerOff")

# Assign permissions
New-VIPermission -Entity (Get-Folder "Production") -Principal "DOMAIN\VMOperators" -Role "VM-Operator"

Hardening Checklist

  • Disable unnecessary services
  • Configure NTP synchronization
  • Enable lockdown mode
  • Set password policies
  • Configure syslog forwarding
  • Enable certificate validation

📊 Monitoring & Alerting

Performance Metrics

# Generate performance report
$report = @()
Get-VMHost | ForEach-Object {
    $hostStats = Get-Stat -Entity $_ -Stat @("cpu.usage.average", "mem.usage.average") -Start (Get-Date).AddHours(-24)
    $report += [PSCustomObject]@{
        Host = $_.Name
        CPU_Avg = ($hostStats | Where {/tmp/vmware-cis-vm-wiki.MetricId -eq "cpu.usage.average"} | Measure-Object Value -Average).Average
        Memory_Avg = ($hostStats | Where {/tmp/vmware-cis-vm-wiki.MetricId -eq "mem.usage.average"} | Measure-Object Value -Average).Average
    }
}
$report | Export-Csv "VMHost-Performance-Report.csv" -NoTypeInformation

Health Checks

# Automated health check
function Test-vSphereHealth {
    $results = @()
    
    # Check host connectivity
    Get-VMHost | ForEach-Object {
        $results += [PSCustomObject]@{
            Type = "Host"
            Name = $_.Name
            Status = $_.ConnectionState
            Issue = if ($_.ConnectionState -ne "Connected") { "Host disconnected" } else { "OK" }
        }
    }
    
    # Check VM status
    Get-VM | Where {/tmp/vmware-cis-vm-wiki.PowerState -ne "PoweredOn"} | ForEach-Object {
        $results += [PSCustomObject]@{
            Type = "VM"
            Name = $_.Name
            Status = $_.PowerState
            Issue = "VM not powered on"
        }
    }
    
    return $results
}

🔗 Official Documentation

VMware vSphere Documentation

PowerCLI Resources

Security & Compliance

Learning & Certification

Community Resources

🤝 Contributing

Development Guidelines

  1. Fork the repository
  2. Create feature branch (git checkout -b feature/enhancement)
  3. Follow PowerShell best practices
  4. Test in lab environment
  5. Update documentation
  6. Submit pull request

Code Standards

  • Use approved PowerShell verbs
  • Include comment-based help
  • Implement error handling
  • Follow naming conventions
  • Add parameter validation

📄 License

Educational and professional use - see LICENSE file for details.

Clone this wiki locally