- Introduction to Windows Server
- Installation and Initial Configuration
- Secure Windows Server Operating System
- Secure a Hybrid Active Directory (AD) Infrastructure
- Identify and Remediate Windows Server Security Issues using Azure Services
- Secure Windows Server Networking
- Secure Windows Server Storage
- Implement a Windows Server Failover Cluster
- Manage Failover Clustering
- Implement and Manage Storage Spaces Direct
- Manage Backup and Recovery for Windows Server
- Implement Disaster Recovery using Azure Site Recovery
- Protect Virtual Machines using Hyper-V Replicas
- Migrate On-Premises Storage to On-Premises Servers or Azure
- Migrate On-Premises Servers to Azure
- Migrate Workloads from Previous Versions to Server 2022
- Monitor Windows Server using Windows Server Tools and Azure Services
- Windows Server Roles and Features
- Group Policy Management
- Windows Server Update Services (WSUS)
- Remote Desktop Services
- Windows Server Containers and Docker
- Windows Admin Center
- PowerShell Automation for Windows Server
- Windows Server 2022 Datacenter: For highly virtualized datacenter and cloud environments
- Windows Server 2022 Standard: For physical or minimally virtualized environments
- Windows Server 2022 Essentials: For small businesses with up to 25 users and 50 devices
- Processor: 1.4 GHz 64-bit processor
- RAM: 512 MB minimum, 2 GB for Server with Desktop Experience
- Disk Space: 32 GB minimum
- Network: Ethernet adapter capable of at least gigabit throughput
- Internet: Internet connectivity for updates
- Physical server
- Virtual machine
- Cloud (Azure)
- Containers
-
Boot from Installation Media
- Insert the media and restart the computer
- Press any key when prompted to boot from DVD/USB
-
Windows Setup
- Select language, time and currency format, keyboard
- Click "Next" and then "Install now"
-
Enter Product Key
- Enter your product key or select "I don't have a product key" to continue without activation
-
Select Installation Option
- Choose between "Windows Server Standard/Datacenter (Desktop Experience)" or "Core"
-
Accept License Terms
- Read and accept the license terms
-
Choose Installation Type
- For a new server: "Custom: Install Windows only (advanced)"
-
Select Disk
- Choose where to install Windows Server
- Create partitions if needed
-
Complete Installation
- Windows Server will install and restart
-
Set Administrator Password
<Password must meet complexity requirements> -
Configure Network Settings
# Get network adapters Get-NetAdapter # Configure static IP address New-NetIPAddress -InterfaceIndex <index> -IPAddress 192.168.1.10 -PrefixLength 24 -DefaultGateway 192.168.1.1 # Configure DNS servers Set-DnsClientServerAddress -InterfaceIndex <index> -ServerAddresses 192.168.1.2,8.8.8.8
-
Rename Computer
# Rename computer Rename-Computer -NewName "Server01" -Restart
-
Join Domain (if applicable)
# Join a domain Add-Computer -DomainName "contoso.com" -Credential (Get-Credential) -Restart
-
Update Windows Server
# Using sconfig (menu-driven) sconfig # Using PowerShell Install-Module PSWindowsUpdate Get-WindowsUpdate Install-WindowsUpdate -AcceptAll
-
Enable Windows Defender Firewall
# Enable all profiles Set-NetFirewallProfile -Profile Domain,Public,Private -Enabled True # Check status Get-NetFirewallProfile | Select-Object Name, Enabled
-
Configure User Account Control (UAC)
- Open
Local Security Policy→ Security Options → User Account Control - Or use PowerShell:
# Set UAC to highest level Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" -Name "ConsentPromptBehaviorAdmin" -Value 2
- Open
-
Enable Windows Defender Antivirus
# Enable real-time protection Set-MpPreference -DisableRealtimeMonitoring $false # Run a quick scan Start-MpScan -ScanType QuickScan
-
Apply Security Policies
# Import security templates Secedit /configure /db secedit.sdb /cfg C:\Templates\SecurityTemplate.inf
-
Enable Credential Guard
# Enable Credential Guard Enable-WindowsOptionalFeature -Online -FeatureName DeviceGuard
-
Configure Windows Defender Application Control
# Create and deploy AppLocker policies New-AppLockerPolicy -XmlPolicy C:\Policies\AppLockerPolicy.xml
-
Configure Password Complexity
# Set minimum password length to 14 characters Set-ADDefaultDomainPasswordPolicy -Identity contoso.com -MinPasswordLength 14 # Enable password complexity Set-ADDefaultDomainPasswordPolicy -Identity contoso.com -ComplexityEnabled $true # Set password history to 24 Set-ADDefaultDomainPasswordPolicy -Identity contoso.com -PasswordHistoryCount 24
-
Set Account Lockout Policies
# Set account lockout threshold Set-ADDefaultDomainPasswordPolicy -Identity contoso.com -LockoutThreshold 5 # Set account lockout duration (minutes) Set-ADDefaultDomainPasswordPolicy -Identity contoso.com -LockoutDuration 00:30:00 # Set account lockout observation window (minutes) Set-ADDefaultDomainPasswordPolicy -Identity contoso.com -LockoutObservationWindow 00:30:00
-
Enable Multi-Factor Authentication
- Configure Azure MFA for hybrid environments
- Deploy smart cards or other physical tokens
-
Configure Audit Policies
# Enable audit policies auditpol /set /category:"Account Logon" /success:enable /failure:enable auditpol /set /category:"Account Management" /success:enable /failure:enable auditpol /set /category:"Detailed Tracking" /success:enable /failure:enable auditpol /set /category:"DS Access" /success:enable /failure:enable auditpol /set /category:"Logon/Logoff" /success:enable /failure:enable auditpol /set /category:"Object Access" /success:enable /failure:enable auditpol /set /category:"Policy Change" /success:enable /failure:enable auditpol /set /category:"Privilege Use" /success:enable /failure:enable auditpol /set /category:"System" /success:enable /failure:enable
-
Review Audit Logs
# Get security events Get-EventLog -LogName Security -Newest 50
-
Assess Current AD Environment
# Check Domain Functional Level Get-ADDomain | Select-Object DomainMode # Check Forest Functional Level Get-ADForest | Select-Object ForestMode
-
Clean Up AD Environment
# Find inactive users Search-ADAccount -AccountInactive -TimeSpan 90.00:00:00 # Find and disable inactive computer accounts Get-ADComputer -Filter {LastLogonTimeStamp -lt $time -and Enabled -eq $true} -Properties LastLogonTimeStamp
-
Prerequisites
- .NET Framework 4.5.1+
- PowerShell 3.0+
- Microsoft Azure AD Module
- SQL Server 2012+ (Express or full version)
-
Download and Install Azure AD Connect
# Download from Microsoft's site and run the installer AzureADConnect.msi -
Run the Azure AD Connect Wizard
- Choose "Express Settings" for typical scenarios
- Choose "Customize" for advanced options including:
- Alternate login ID
- Group filtering
- Password writeback
- Device writeback
-
Enable Password Hash Synchronization
# Verify synchronization is enabled Get-ADSyncScheduler # Enable synchronization if disabled Set-ADSyncScheduler -SyncCycleEnabled $true
-
Test Sync with Azure AD
# Run a delta sync Start-ADSyncSyncCycle -PolicyType Delta # Run a full sync Start-ADSyncSyncCycle -PolicyType Initial
-
Implement Tiered Administration Model
- Tier 0: Domain Controllers, Domain Admins
- Tier 1: Server Administrators
- Tier 2: Workstation Administrators
-
Implement Privileged Access Management
# Enable Privileged Access Management Enable-ADOptionalFeature 'Privileged Access Management Feature' -Scope ForestOrConfigurationSet -Target contoso.com
-
Implement Administrative Forest Design
- Create separate administrative forest for privileged accounts
- Set up one-way trust relationship
-
Secure Domain Controllers
# Verify secure boot is enabled on DCs Confirm-SecureBootUEFI # Check DC security settings Get-ADDomainController -Filter * | Select-Object Name, OperatingSystem
-
Enable Protected Users Security Group
# Add users to Protected Users group Add-ADGroupMember -Identity 'Protected Users' -Members User1,User2
-
Implement Microsoft Defender for Identity
- Deploy sensors on Domain Controllers
- Connect to Microsoft 365 Defender portal
-
Enable Azure Security Center
- Navigate to Azure Portal
- Select "Security Center" or "Microsoft Defender for Cloud"
- Complete onboarding process
-
Install Monitoring Agent
# Download and install monitoring agent $MMASetupConfig = "$env:SystemDrive\MMASetup-AMD64.exe" Invoke-WebRequest -Uri "https://go.microsoft.com/fwlink/?LinkId=828603" -OutFile $MMASetupConfig & $MMASetupConfig /qn NOAPM=1 ADD_OPINSIGHTS_WORKSPACE=1 OPINSIGHTS_WORKSPACE_AZURE_CLOUD_TYPE=0 OPINSIGHTS_WORKSPACE_ID="<workspaceID>" OPINSIGHTS_WORKSPACE_KEY="<workspaceKey>"
-
Run a Security Assessment
- Review Secure Score in Azure Security Center
- Check recommendations by resource type
-
Review and Implement Security Recommendations
# Get security recommendations using PowerShell Get-AzSecurityRecommendation | Select-Object Name, ResourceId, RecommendationType, Severity # Get detailed information about a specific recommendation Get-AzSecurityRecommendation -Name "<recommendation-name>" | Select-Object Name, Description, Severity, State, TimeGenerated
-
Remediate Issues
# Example: Enable JIT VM Access $resource = Get-AzResource -ResourceId "<resourceId>" Set-AzJitNetworkAccessPolicy -ResourceGroupName $resource.ResourceGroupName -Location $resource.Location -Name $resource.Name -VirtualMachine "<vmConfig>"
-
Deploy Azure Sentinel
- Create or select Log Analytics workspace
- Add Azure Sentinel to the workspace
-
Connect Data Sources
- Connect Windows Security Events
- Connect Azure Activity logs
- Connect Microsoft 365 Defender
-
Create Custom Detection Rules
# Example KQL query for detecting brute force attempts SecurityEvent | where EventID == 4625 | where TimeGenerated > ago(1h) | summarize count() by TargetAccount, IpAddress, Computer | where count_ > 10 -
Implement Automated Response
- Create automation rules
- Set up playbooks with Logic Apps
-
Enable Windows Defender Firewall
# Enable firewall for all profiles Set-NetFirewallProfile -Profile Domain,Public,Private -Enabled True # Check firewall status Get-NetFirewallProfile | Select-Object Name, Enabled
-
Configure Firewall Rules
# Allow RDP traffic New-NetFirewallRule -DisplayName "Allow RDP" -Direction Inbound -Protocol TCP -LocalPort 3389 -Action Allow # Block specific IP addresses New-NetFirewallRule -DisplayName "Block Malicious IPs" -Direction Inbound -RemoteAddress 192.168.1.100,10.0.0.1/24 -Action Block
-
Create Rule Groups
# Create a rule group New-NetFirewallRule -DisplayName "SQL Server Rules" -Group "Database" -Direction Inbound -Protocol TCP -LocalPort 1433 -Action Allow # Enable or disable group Get-NetFirewallRule -Group "Database" | Enable-NetFirewallRule
-
Configure IPsec
# Create IPsec rule for secure communication New-NetIPsecRule -DisplayName "Secure Communication" -InboundSecurity Require -OutboundSecurity Request
-
Create Connection Security Rules
# Create a server-to-server rule New-NetIPsecRule -DisplayName "Server to Server" -Mode TransportMode -Authentication RequireComputer
-
Implement VLANs
# Configure VLAN ID on network adapter Set-NetAdapterAdvancedProperty -Name "Ethernet" -RegistryKeyword VlanID -RegistryValue 10
-
Configure Routing
# Add static route New-NetRoute -DestinationPrefix "10.0.0.0/24" -NextHop "192.168.1.1" -InterfaceIndex 12
-
Install Remote Access Role
# Install Remote Access role Install-WindowsFeature RemoteAccess -IncludeManagementTools # Install DirectAccess and VPN Install-WindowsFeature DirectAccess-VPN -IncludeManagementTools
-
Configure VPN Settings
# Install VPN components Install-RemoteAccess -VpnType RoutingOnly # Configure VPN server Set-VpnServerConfiguration -AuthenticationMethod EAP -TunnelType Automatic
-
Configure SSL Certificate
# Assign certificate to VPN server Set-VpnServerIPsecConfiguration -CustomPolicy -AuthenticationTransformConstants SHA256128 -CipherTransformConstants AES128
-
Install Web Application Proxy
Install-WindowsFeature Web-Application-Proxy -IncludeManagementTools
-
Configure Web Application Proxy
Install-WebApplicationProxy -FederationServiceName "sts.contoso.com" -CertificateThumbprint "<cert-thumbprint>"
-
Prerequisites
# Install BitLocker feature Install-WindowsFeature BitLocker -IncludeManagementTools
-
Enable TPM
- Configure TPM in BIOS/UEFI
-
Encrypt System Drive
# Enable BitLocker on system drive Enable-BitLocker -MountPoint "C:" -EncryptionMethod AES256 -UsedSpaceOnly -TpmProtector
-
Encrypt Data Drives
# Enable BitLocker on data drive Enable-BitLocker -MountPoint "D:" -EncryptionMethod AES256 -UsedSpaceOnly -PasswordProtector
-
Back Up Recovery Keys
# Back up recovery key to AD Backup-BitLockerKeyProtector -MountPoint "C:" -KeyProtectorId $(Get-BitLockerVolume -MountPoint "C:").KeyProtector[0].KeyProtectorId
-
Verify Encryption Status
# Check encryption status Get-BitLockerVolume
-
Enable EFS Certificate
# Generate EFS certificate cipher /r:EFSCert
-
Encrypt Files or Folders
# Encrypt a folder cipher /e /s:C:\ConfidentialData
-
Back Up EFS Certificates
# Export EFS certificate certmgr.msc # Navigate to Personal -> Certificates -> Export
-
Set NTFS Permissions
# Grant permissions to a folder $acl = Get-Acl "C:\Data" $AccessRule = New-Object System.Security.AccessControl.FileSystemAccessRule("CONTOSO\Finance","Modify","Allow") $acl.SetAccessRule($AccessRule) $acl | Set-Acl "C:\Data"
-
Configure Auditing
# Enable auditing on a folder $acl = Get-Acl "C:\ConfidentialData" $AuditRule = New-Object System.Security.AccessControl.FileSystemAuditRule("Everyone","ReadData","Success") $acl.AddAuditRule($AuditRule) $acl | Set-Acl "C:\ConfidentialData"
-
Implement File Screening
# Install File Server Resource Manager Install-WindowsFeature -Name FS-Resource-Manager -IncludeManagementTools # Create file screen New-FsrmFileScreen -Path "D:\SharedFolder" -Template "Block Audio and Video Files"
-
Azure Storage Service Encryption
# Enable encryption for Azure Storage Account Set-AzStorageAccount -ResourceGroupName "RG1" -Name "storage1" -EnableEncryptionService "Blob" -KeyType "Service"
-
Azure Disk Encryption
# Enable Azure Disk Encryption Set-AzVMDiskEncryptionExtension -ResourceGroupName "RG1" -VMName "VM1" -DiskEncryptionKeyVaultUrl "https://mykeyvault.vault.azure.net/" -DiskEncryptionKeyVaultId "/subscriptions/{subscriptionId}/resourceGroups/RG1/providers/Microsoft.KeyVault/vaults/mykeyvault"
-
Verify Hardware Compatibility
- Check supported hardware on Windows Server Catalog
- Ensure shared storage is available (SAN, iSCSI, etc.)
-
Network Configuration
# Configure dedicated NICs for cluster communication Rename-NetAdapter -Name "Ethernet" -NewName "Public" Rename-NetAdapter -Name "Ethernet 2" -NewName "Cluster" # Configure static IP addresses for cluster network New-NetIPAddress -InterfaceAlias "Cluster" -IPAddress 192.168.10.1 -PrefixLength 24
-
Install Failover Clustering Feature
# Install on all nodes Install-WindowsFeature -Name Failover-Clustering -IncludeManagementTools
-
Run Cluster Validation
# Test cluster configuration Test-Cluster -Node Server1,Server2,Server3
-
Create a Cluster
# Create new cluster with static IP New-Cluster -Name ClusterName -Node Server1,Server2,Server3 -StaticAddress 192.168.1.100
-
Configure Quorum Settings
# Set quorum to Node Majority with File Share Witness Set-ClusterQuorum -FileShareWitness "\\fileserver\witness"
-
Set Network Priority
# Set cluster network priority (Get-ClusterNetwork -Name "Cluster").Metric = 100 (Get-ClusterNetwork -Name "Public").Metric = 1000
-
Configure Cluster Network Roles
# Set network roles (Get-ClusterNetwork -Name "Cluster").Role = 1 # Cluster communications only (Get-ClusterNetwork -Name "Public").Role = 3 # Client and cluster communications
-
Configure Cluster IP Address Settings
# Add additional cluster IP addresses Add-ClusterResource -Name "IP Address 192.168.2.100" -ResourceType "IP Address" -Group "Cluster Group"
-
Add Shared Storage
# Add disk to cluster Add-ClusterDisk -InputObject (Get-Disk -Number 1)
-
Configure Cluster Shared Volumes (CSV)
# Enable CSV Enable-ClusterSharedVolume -Name "Cluster Disk 1"
-
Configure Storage QoS
# Create Storage QoS policy New-StorageQosPolicy -Name "VDI" -MinimumIops 100 -MaximumIops 500
-
Check Cluster Node Status
# Get node status Get-ClusterNode # Get detailed node information Get-ClusterNode | Format-List *
-
Check Cluster Resource Status
# Get resource status Get-ClusterResource # Get detailed resource information Get-ClusterResource -Name "SQL Server" | Format-List *
-
View Cluster Events
# Get cluster events Get-ClusterLog -Destination C:\Logs
-
Add a Resource to the Cluster
# Add a file server resource Add-ClusterFileServerRole -Name "FileServer" -Storage "Cluster Disk 2" -StaticAddress 192.168.1.101
-
Configure Resource Dependencies
# Set resource dependency Set-ClusterResourceDependency -Resource "SQL Server" -Dependency "[Cluster Disk 3] AND [SQL IP Address]"
-
Failover a Cluster Role
# Move cluster group to another node Move-ClusterGroup -Name "SQL Server Group" -Node "Server2"
-
Configure Preferred Owners
# Set preferred owners Set-ClusterOwnerNode -Group "SQL Server Group" -Owners Server1,Server2
-
Apply Windows Updates
# Drain node for maintenance Suspend-ClusterNode -Name "Server1" -Drain # Install updates Install-WindowsUpdate -AcceptAll # Resume node Resume-ClusterNode -Name "Server1"
-
Upgrade Cluster Functional Level
# Check current functional level Get-Cluster | Select ClusterFunctionalLevel # Update functional level Update-ClusterFunctionalLevel
-
Add a Node to Existing Cluster
# Add new node Add-ClusterNode -Name "Server4" -Cluster "ClusterName"
-
Remove a Node from Cluster
# Remove node Remove-ClusterNode -Name "Server3"
-
Configure CAU
# Install CAU features Install-WindowsFeature -Name RSAT-Clustering-PowerShell # Add CAU clustered role Add-CauClusterRole -ClusterName "ClusterName" -Force
-
Run CAU Updates
# Invoke CAU scanning Invoke-CauScan -ClusterName "ClusterName" # Invoke CAU run Invoke-CauRun -ClusterName "ClusterName"
-
Schedule Automatic Updates
# Create a scheduled task for CAU Add-CauClusterRole -ClusterName "ClusterName" -DaysOfWeek Sunday -StartTime "3:00 AM" -Force
-
Hardware Requirements
- Minimum of 2 servers (4+ recommended)
- Each server needs:
- CPU: 1.4 GHz 64-bit processor
- RAM: 16GB minimum (32GB+ recommended)
- Network: RDMA capable NICs
- Storage: NVMe, SSD, HDD in tiered configuration
-
Software Requirements
# Install required features on all nodes Install-WindowsFeature -Name "Failover-Clustering", "Data-Center-Bridging", "RSAT-Clustering-PowerShell", "Hyper-V", "FS-FileServer"
-
Network Configuration
# Configure RDMA Enable-NetAdapterRDMA -Name "RDMA1", "RDMA2" # Configure QoS for SMB New-NetQosPolicy "SMB" -NetDirectPortMatchCondition 445 -PriorityValue8021Action 3
-
Create a Failover Cluster
# Create cluster New-Cluster -Name "S2DCluster" -Node "Server1", "Server2", "Server3", "Server4" -NoStorage
-
Enable Storage Spaces Direct
# Enable S2D Enable-ClusterStorageSpacesDirect -CimSession "S2DCluster"
-
Verify S2D Health
# Check pool health Get-StoragePool -CimSession "S2DCluster" -FriendlyName "S2D*" # Check physical disk health Get-PhysicalDisk -CimSession "S2DCluster"
-
Create a Virtual Disk
# Create a three-way mirror virtual disk New-Volume -CimSession "S2DCluster" -StoragePoolFriendlyName "S2D*" -FriendlyName "Volume1" -FileSystem CSVFS_ReFS -Size 1TB -ResiliencySettingName Mirror
-
Create a Volume with Storage Tiers
# Create volume with auto-tiering New-Volume -CimSession "S2DCluster" -StoragePoolFriendlyName "S2D*" -FriendlyName "Volume2" -FileSystem CSVFS_ReFS -Size 2TB -ResiliencySettingName Mirror -MediaType HDD, SSD
-
Extend a Volume
# Extend existing volume Resize-Volume -CimSession "S2DCluster" -Path "C:\ClusterStorage\Volume1" -Size 2TB
-
Configure Caching
# Set caching behavior Set-ClusterStorageSpacesDirect -CimSession "S2DCluster" -CacheMode ReadWrite
-
Optimize Storage Tiers
# Set performance tier reservation Set-StorageTier -CimSession "S2DCluster" -FriendlyName "Performance" -MinimumSize 200GB
-
Monitor Storage Tiers
# Get tier usage statistics Get-StorageTier ## Implement and Manage Storage Spaces Direct (Continued)
-
Monitor Storage Performance
# Get performance counters Get-Counter -Counter "\Cluster Storage Hybrid Disks(*)\*" -CimSession "S2DCluster" # Check IO latency Get-StorageSubSystem -CimSession "S2DCluster" | Get-StorageHealthReport -CimSession "S2DCluster" -Name "IOLatency"
-
Monitor Cache Performance
# Check cache hit ratio Get-ClusterPerf -MetricName "Cache*" # Check cache health Get-StorageHealthReport -CimSession "S2DCluster" -Name "CacheState"
-
Optimize Deduplication
# Enable deduplication on volume Enable-DedupVolume -Volume "C:\ClusterStorage\Volume1" -UsageType HyperV # Set deduplication schedule Set-DedupSchedule -Name "WeeklyOptimization" -Days Saturday -Start 01:00 -DurationHours 12
-
Replace a Failed Disk
# Identify failed disk Get-PhysicalDisk -CimSession "S2DCluster" | Where-Object HealthStatus -eq "Unhealthy" # Remove failed disk Remove-PhysicalDisk -PhysicalDisk (Get-PhysicalDisk -SerialNumber "XYZ123456" -CimSession "S2DCluster") # Add new disk Add-PhysicalDisk -PhysicalDisks (Get-PhysicalDisk -SerialNumber "ABC789012" -CimSession "S2DCluster") -StoragePoolFriendlyName "S2D*" -CimSession "S2DCluster"
-
Repair Virtual Disk
# Check repair status Get-StorageJob -CimSession "S2DCluster" # Repair virtual disk Repair-VirtualDisk -FriendlyName "Volume1" -CimSession "S2DCluster"
-
Suspend and Resume a Node
# Suspend node for maintenance Suspend-ClusterNode -Name "Server1" -Drain # Resume node after maintenance Resume-ClusterNode -Name "Server1"
-
Install Windows Server Backup
# Install feature Install-WindowsFeature -Name Windows-Server-Backup -IncludeManagementTools
-
Create a One-Time Backup
# Backup system state wbadmin start systemstatebackup -backupTarget:E: # Backup full server wbadmin start backup -backupTarget:E: -include:C: -allCritical
-
Create a Backup Schedule
# Schedule daily backup wbadmin enable backup -addtarget:E: -schedule:12:00 -include:C:,D: -systemState -vssFull # Using PowerShell $policy = New-WBPolicy $fileSpec = New-WBFileSpec -FileSpec "C:\Data" Add-WBFileSpec -Policy $policy -FileSpec $fileSpec $backupLocation = New-WBBackupTarget -VolumePath "E:" Add-WBBackupTarget -Policy $policy -Target $backupLocation Set-WBSchedule -Policy $policy -Schedule 12:00
-
Recover from Backup
# List available backups wbadmin get versions # Recover specific files wbadmin start recovery -version:01/01/2023-12:00 -itemPath:"C:\Data" -recoverytarget:"D:\Restored" # Recover system state wbadmin start systemstaterecovery -version:01/01/2023-12:00
-
Install DPM Server
- Prerequisites: SQL Server, Windows Assessment and Deployment Kit
-
Configure Protection Groups
# Create a new protection group New-DPMProtectionGroup -DPMServerName "DPMServer" -Name "FileServers" # Add data sources Add-DPMDatasource -ProtectionGroup $pg -DatasourceName "FileServer" -Path "\\FileServer\Share"
-
Configure Backup Schedule
# Set protection schedule Set-DPMPolicySchedule -ProtectionGroup $pg -LongTerm -Day Friday -Time "20:00"
-
Perform Recovery
# Recover data to original location Get-DPMRecoveryPoint -DatasourceName "FileServer" | Restore-DPMRecoverableItem -OriginalLocation
-
Install Azure Backup Agent
# Download and install agent $wc = New-Object System.Net.WebClient $wc.DownloadFile("https://aka.ms/azurebackup_agent", "$env:TEMP\MARSAgentInstaller.exe") & "$env:TEMP\MARSAgentInstaller.exe" /q
-
Register Server with Azure Backup
# Register server Start-Process "C:\Program Files\Microsoft Azure Recovery Services Agent\bin\OBRegistrationUI.exe"
-
Configure Backup Schedule
# Set backup schedule $pol = New-OBPolicy $include = New-OBFileSpec -FileSpec "C:\Data" Add-OBFileSpec -Policy $pol -FileSpec $include Set-OBSchedule -Policy $pol -Schedule ([DateTime]::Parse("6:00 PM")) Set-OBRetentionPolicy -Policy $pol -RetentionPolicy ([DateTime]::Parse("30 days"))
-
Perform Recovery from Azure
# Start recovery wizard Start-Process "C:\Program Files\Microsoft Azure Recovery Services Agent\bin\OBRecoveryUI.exe"
-
Backup System State
# Create system state backup wbadmin start systemstatebackup -backupTarget:E:
-
Schedule System State Backup
# Enable scheduled backup wbadmin enable systemstatebackup -addtarget:E: -schedule:02:00
-
Recover System State
# Perform system state recovery wbadmin start systemstaterecovery -version:01/01/2023-02:00 -backupTarget:E:
-
Azure Requirements
- Azure subscription
- Azure Recovery Services vault
- Virtual network (for failover)
- Storage account
-
On-Premises Requirements
- Windows Server 2016 or later
- Hardware that meets Hyper-V requirements
- Network connectivity to Azure
-
Create Recovery Services Vault
# Create new vault New-AzRecoveryServicesVault -Name "ASRVault" -ResourceGroupName "RG1" -Location "East US" # Set vault context Set-AzRecoveryServicesVaultContext -Vault $vault
-
Set Up Protection Goals
# Set protection goal Set-AzRecoveryServicesAsrProtectionContainerMapping -Name "OnPremToAzure" -PrimaryProtectionContainer $primaryContainer -RecoveryProtectionContainer $recoveryContainer -Policy $policy
-
Deploy Configuration Server
- Download unified setup from Azure portal
- Install configuration server on-premises
-
Enable Replication for VMs
# Enable replication for VM New-AzRecoveryServicesAsrReplicationProtectedItem -VMType Hyper-V -Name "VM1" -ProtectionContainer $primaryContainer -RecoveryAzureStorageAccountId $storageAccountID -OSDiskName "VM1-OS" -OS Windows
-
Configure Replication Settings
# Set replication policy $policy = New-AzRecoveryServicesAsrPolicy -Name "ReplicationPolicy" -RecoveryPoint 24 -RecoveryPointRetentionInHours 24
-
Monitor Replication Health
# Check replication status Get-AzRecoveryServicesAsrReplicationProtectedItem -ProtectionContainer $container | Select FriendlyName, ProtectionState, ReplicationHealth
-
Create Recovery Plan
# Create plan $plan = New-AzRecoveryServicesAsrRecoveryPlan -Name "RecoveryPlan1" -PrimaryFabric $primaryFabric -RecoveryFabric $recoveryFabric
-
Run Test Failover
# Start test failover Start-AzRecoveryServicesAsrTestFailoverJob -RecoveryPlan $plan -Direction PrimaryToRecovery
-
Perform Planned Failover
# Start planned failover Start-AzRecoveryServicesAsrPlannedFailoverJob -RecoveryPlan $plan -Direction PrimaryToRecovery
-
Perform Unplanned Failover
# Start unplanned failover Start-AzRecoveryServicesAsrUnplannedFailoverJob -RecoveryPlan $plan -Direction PrimaryToRecovery
-
Commit Failover
# Commit Start-AzRecoveryServicesAsrCommitFailoverJob -RecoveryPlan $plan
-
Failback to Primary
# Start reprotect Start-AzRecoveryServicesAsrReProtectionJob -RecoveryPlan $plan # Start failback Start-AzRecoveryServicesAsrPlannedFailoverJob -RecoveryPlan $plan -Direction RecoveryToPrimary
-
Install Hyper-V Role
# Install on primary and replica servers Install-WindowsFeature -Name Hyper-V -IncludeManagementTools
-
Configure Hyper-V Replica
# Enable replication on source server Enable-VmReplication -VMName "VM1" -ReplicaServerName "Server2" -ReplicaServerPort 80 -AuthenticationType Kerberos -ComputerName "Server1"
-
Enable Extended Replication
# Set up tertiary replica Enable-VmReplication -VMName "VM1" -ReplicaServerName "Server3" -ReplicaServerPort 80 -AuthenticationType Kerberos -ComputerName "Server2" -AsExtendedReplica
-
Set Replication Frequency
# Set 30-second replication Set-VMReplication -VMName "VM1" -ReplicationFrequencySec 30
-
Configure Recovery Points
# Keep 12 recovery points Set-VMReplication -VMName "VM1" -RecoveryHistory 12
-
Configure Network Bandwidth
# Limit bandwidth usage Set-VMReplication -VMName "VM1" -CompressionEnabled $true -ReplicateHostKvpItems $true
-
Planned Failover
# Start planned failover Start-VMFailover -VMName "VM1" -ComputerName "Server1" -Prepare # Complete failover Start-VMFailover -VMName "VM1" -ComputerName "Server2" # Start replica VM Start-VM -VMName "VM1" -ComputerName "Server2"
-
Test Failover
# Create test VM Start-VMFailover -VMName "VM1" -ComputerName "Server2" -AsTest # Start test VM Start-VM -VMName "VM1 - Test" -ComputerName "Server2"
-
Unplanned Failover
# Start unplanned failover Start-VMFailover -VMName "VM1" -ComputerName "Server2" # Start VM Start-VM -VMName "VM1" -ComputerName "Server2"
-
Failback to Primary
# Reverse replication Set-VMReplication -VMName "VM1" -Reverse -ComputerName "Server2" # Perform failback Start-VMFailover -VMName "VM1" -ComputerName "Server2" -Prepare Start-VMFailover -VMName "VM1" -ComputerName "Server1"
-
Install Storage Migration Service
# Install feature Install-WindowsFeature -Name SMS -IncludeManagementTools
-
Create a Migration Job
# Create new job New-SmsJob -Name "FileServerMigration"
-
Run Inventory
# Inventory source servers Invoke-SmsJobInventory -JobName "FileServerMigration" -SourceComputer "OldServer"
-
Run Transfer
# Transfer data to destination Invoke-SmsJobTransfer -JobName "FileServerMigration" -DestinationComputer "NewServer"
-
Complete Cutover
# Perform cutover Invoke-SmsJobCutover -JobName "FileServerMigration"
-
Deploy Storage Sync Service in Azure
# Create storage sync service New-AzStorageSyncService -ResourceGroupName "RG1" -Name "StorageSync1" -Location "East US"
-
Create Sync Group
# Create new sync group New-AzStorageSyncGroup -ParentObject $service -Name "FileShare1"
-
Add Cloud Endpoint
# Add cloud endpoint New-AzStorageSyncCloudEndpoint -ParentObject $syncGroup -Name "CloudEndpoint" -StorageAccountId $storageAccount.Id -FileShareName "share1"
-
Install Azure File Sync Agent
# Download and install agent Invoke-WebRequest -Uri "https://aka.ms/afs/agent/Server2022" -OutFile "$env:TEMP\AzureFileSync.msi" Start-Process -FilePath "$env:TEMP\AzureFileSync.msi" -ArgumentList "/qn" -Wait
-
Register Server with Storage Sync Service
# Register server Register-AzStorageSyncServer -ParentObject $service
-
Add Server Endpoint
# Create server endpoint New-AzStorageSyncServerEndpoint -ParentObject $syncGroup -Name "ServerEndpoint" -ServerResourceId $server.Id -ServerLocalPath "D:\Data"
-
Install Migration Tools
# Install tools Install-WindowsFeature -Name Migration
-
Register Source Server
Register-SmigServerSetting -InputFile C:\Source.xml
-
Export Server Settings
Export-SmigServerSetting -FeatureID FileServices -Path C:\FileServices.xml
-
Import Server Settings
Import-SmigServerSetting -FeatureID FileServices -Path C:\FileServices.xml -Force
-
Set Up Azure Migrate Project
# Create project New-AzMigrateProject -Name "ServerMigration" -ResourceGroupName "RG1" -Location "East US"
-
Deploy Appliance
- Download Azure Migrate appliance
- Set up as a VM on-premises
- Register with Azure Migrate project
-
Discover Servers
# Start discovery Start-AzMigrateDiskReplication -ResourceGroupName "RG1" -ProjectName "ServerMigration" -DiscoverySourceID $source.Id
-
Assess Servers
# Create assessment New-AzMigrateAssessment -Name "ServerAssessment" -Group $group -Project $project -AssessmentProperties $props
-
Migrate Servers
# Start replication New-AzMigrateServerReplication -ResourceGroupName "RG1" -ProjectName "ServerMigration" -MachineId $machine.Id -TargetResourceGroupId $targetRG.Id -TargetNetworkId $targetNetwork.Id -TargetSubnetName "default" # Test migration Start-AzMigrateTestMigration -ResourceGroupName "RG1" -ProjectName "ServerMigration" -MachineId $machine.Id # Start migration Start-AzMigrateMigration -ResourceGroupName "RG1" -ProjectName "ServerMigration" -MachineId $machine.Id
-
Set Up Configuration Server
- Download unified setup
- Install on VMware/Physical environment
- Register with Recovery Services vault
-
Install Mobility Service
# Install on each server .\MobilityServiceInstaller.exe /q /x:C:\Temp\Extracted cd C:\Temp\Extracted .\installmobilityservice.ps1 ConfigurationServer IpAddress Password
-
Enable Replication
# Enable VM replication New-AzRecoveryServicesAsrReplicationProtectedItem -VMType VMware -Name "Server1" -ProtectionContainer $container -RecoveryVmName "Server1-Azure" -RecoveryAzureStorageAccountId $storage.Id -OSDiskName "Server1-OS" -OS Windows
-
Perform Migration
# Start migration Start-AzRecoveryServicesAsrUnplannedFailoverJob -ReplicationProtectedItem $rpi -Direction PrimaryToRecovery # Complete migration Start-AzRecoveryServicesAsrCommitFailoverJob -ReplicationProtectedItem $rpi
-
Create Migration Service
# Create service New-AzDataMigrationService -ResourceGroupName "RG1" -Name "DBMigration" -Location "East US" -Sku "Premium_4vCores"
-
Create Migration Project
# Create project New-AzDataMigrationProject -ResourceGroupName "RG1" -ServiceName "DBMigration" -ProjectName "SQLMigration" -SourceType SQL -TargetType SQLDB
-
Run Assessment
# Assess database compatibility Start-AzDataMigrationAssessment -ResourceGroupName "RG1" -ServiceName "DBMigration" -ProjectName "SQLMigration" -SourceConnectionInfo $sourceConnection -DatabaseNames "DB1"
-
Migrate Database
# Start migration New-AzDataMigrationTask -ResourceGroupName "RG1" -ServiceName "DBMigration" -ProjectName "SQLMigration" -TaskName "MigrateDB" -SourceConnectionInfo $sourceConnection -TargetConnectionInfo $targetConnection -TaskType OnlineMigration
-
Assess Upgrade Readiness
# Install Windows Assessment Services Import-Module ServerManager Install-WindowsFeature Windows-Assessment-Services # Run assessment Test-WindowsServerUpgradability
-
Perform In-Place Upgrade
- Mount Windows Server 2022 ISO
- Run setup.exe
- Choose "Upgrade" option
-
Post-Upgrade Tasks
# Verify server features Get-WindowsFeature | Where-Object {$_.Installed -eq $true} # Install updates Install-WindowsUpdate -AcceptAll
-
Export Server Configuration
# Export server roles Export-SmigServerSetting -FeatureID DNS,DHCP -Path C:\ServerConfig.xml
-
Deploy New Server
- Install clean Windows Server 2022
- Join to same domain
- Configure networking
-
Import Server Configuration
# Import server roles Import-SmigServerSetting -FeatureID DNS,DHCP -Path C:\ServerConfig.xml -Force
-
Migrate Data
# Use robocopy to transfer data robocopy \\OldServer\Share D:\Share /E /COPYALL /DCOPY:DAT /MIR /R:3 /W:3 /MT:32 /LOG:C:\Logs\RobocopyLog.txt
-
Export IIS Configuration
# Export configuration Export-IISConfiguration -PhysicalPath C:\IISExport.xml
-
Install IIS on New Server
# Install IIS role Install-WindowsFeature -Name Web-Server -IncludeManagementTools # Install required features Install-WindowsFeature -Name Web-Asp-Net45,Web-Net-Ext45,Web-ISAPI-Ext,Web-ISAPI-Filter,Web-Mgmt-Console
-
Import IIS Configuration
# Import configuration Import-IISConfiguration -PhysicalPath C:\IISExport.xml
-
Migrate Website Content
# Copy website files robocopy \\OldServer\c$\inetpub\wwwroot C:\inetpub\wwwroot /E /COPYALL /R:3 /W:3
-
Prepare for Active Directory Migration
# Check domain and forest functional levels Get-ADDomain | Select-Object DomainMode Get-ADForest | Select-Object ForestMode
-
Add Domain Controller to Existing Domain
# Install AD DS role Install-WindowsFeature -Name AD-Domain-Services -IncludeManagementTools # Promote to DC Install-ADDSDomainController -DomainName "contoso.com" -Credential (Get-Credential) -InstallDns
-
Transfer FSMO Roles
# Move Schema Master Move-ADDirectoryServerOperationMasterRole -Identity "NewDC" -OperationMasterRole SchemaMaster # Move Domain Naming Master Move-ADDirectoryServerOperationMasterRole -Identity "NewDC" -OperationMasterRole DomainNamingMaster # Move RID, PDC, and Infrastructure Master Move-ADDirectoryServerOperationMasterRole -Identity "NewDC" -OperationMasterRole RIDMaster,PDCEmulator,InfrastructureMaster
-
Demote Old Domain Controllers
# Demote DC Uninstall-ADDSDomainController -Credential (Get-Credential) -DemoteOperationMasterRole
-
Install AD CS
# Install role Install-WindowsFeature -Name ADCS-Cert-Authority -IncludeManagementTools # Configure CA Install-AdcsCertificationAuthority -CAType EnterpriseRootCA -CACommonName "Contoso Enterprise CA" -KeyLength 4096 -ValidityPeriod Years -ValidityPeriodUnits 10
-
Deploy Certificate Templates
# Copy template Copy-CATemplate -Name WebServer -DisplayName "Contoso Web Server" # Modify template permissions dsacls "CN=Contoso Web Server,CN=Certificate Templates,CN=Public Key Services,CN=Services,CN=Configuration,DC=contoso,DC=com" /G "CONTOSO\Web Administrators:RPWP;WRITE_PROPERTY"
-
Issue Certificates
# Enable template Add-CATemplate -Name "Contoso Web Server" # Request certificate Get-Certificate -Template "Contoso Web Server" -CertStoreLocation Cert:\LocalMachine\My
-
Install DNS Server
# Install role Install-WindowsFeature -Name DNS -IncludeManagementTools
-
Create Forward Lookup Zone
# Create primary zone Add-DnsServerPrimaryZone -Name "contoso.com" -ZoneFile "contoso.com.dns"
-
Create Reverse Lookup Zone
# Create reverse lookup zone Add-DnsServerPrimaryZone -NetworkID "192.168.1.0/24" -ZoneFile "1.168.192.in-addr.arpa.dns"
-
Create DNS Records
# Add A record Add-DnsServerResourceRecordA -ZoneName "contoso.com" -Name "server1" -IPv4Address "192.168.1.10" # Add CNAME record Add-DnsServerResourceRecordCName -ZoneName "contoso.com" -Name "www" -HostNameAlias "server1.contoso.com"
-
Configure Forwarders
# Set forwarders Set-DnsServerForwarder -IPAddress 8.8.8.8, 8.8.4.4
-
Install DHCP Server
# Install role Install-WindowsFeature -Name DHCP -IncludeManagementTools
-
Authorize DHCP Server
# Authorize in AD Add-DhcpServerInDC -DnsName "dhcp1.contoso.com" -IPAddress 192.168.1.10
-
Create DHCP Scope
# Create IPv4 scope Add-DhcpServerv4Scope -Name "Corporate" -StartRange 192.168.1.100 -EndRange 192.168.1.200 -SubnetMask 255.255.255.0
-
Configure DHCP Options
# Set scope options Set-DhcpServerv4OptionValue -ScopeId 192.168.1.0 -Router 192.168.1.1 -DnsServer 192.168.1.10 -DnsDomain "contoso.com"
-
Configure DHCP Reservations
# Add reservation Add-DhcpServerv4Reservation -ScopeId 192.168.1.0 -IPAddress 192.168.1.50 -ClientId "00-11-22-33-44-55" -Description "Printer"
-
Install File Server Role
# Install role Install-WindowsFeature -Name FS-FileServer -IncludeManagementTools
-
Create Shares
# Create SMB share New-SmbShare -Name "Public" -Path "D:\Shares\Public" -FullAccess "Everyone"
-
Configure Share Permissions
# Set share permissions Grant-SmbShareAccess -Name "Public" -AccountName "CONTOSO\Sales" -AccessRight Change Revoke-SmbShareAccess -Name "Public" -AccountName "Everyone"
-
Configure NTFS Permissions
# Set NTFS permissions $acl = Get-Acl -Path "D:\Shares\Public" $permission = "CONTOSO\Sales","Modify","Allow" $accessRule = New-Object -TypeName System.Security.AccessControl.FileSystemAccessRule -ArgumentList $permission $acl.SetAccessRule($accessRule) $acl | Set-Acl -Path "D:\Shares\Public"
-
Configure DFS Namespaces
# Install DFS Install-WindowsFeature -Name FS-DFS-Namespace,FS-DFS-Replication -IncludeManagementTools # Create namespace New-DfsnRoot -TargetPath "\\Server1\Public" -Type DomainV2 -Path "\\contoso.com\shares"
- Install IIS
# Install role with common features Install-WindowsFeature -Name Web-Server -IncludeManagementTools # Install additional features Install-WindowsFeature -Name Web-Asp-Net45,Web-Net-Ext
-
Install Group Policy Management Tools
# Install GPMC Install-WindowsFeature -Name GPMC
-
Open Group Policy Management Console
# Open GPMC gpmc.msc
-
Create a New GPO
# Create a new GPO New-GPO -Name "Security Settings" # Create and link in one step New-GPO -Name "Desktop Settings" | New-GPLink -Target "OU=Marketing,DC=contoso,DC=com"
-
Link a GPO to an OU
# Link existing GPO to OU New-GPLink -Name "Security Settings" -Target "OU=IT,DC=contoso,DC=com"
-
Set GPO Processing Order
# Set link order (lower number = higher priority) Set-GPLink -Name "Security Settings" -Target "OU=IT,DC=contoso,DC=com" -Order 1
-
Disable a GPO Link
# Disable a GPO link Set-GPLink -Name "Security Settings" -Target "OU=IT,DC=contoso,DC=com" -LinkEnabled No
-
Password Policy
- Computer Configuration → Policies → Windows Settings → Security Settings → Account Policies → Password Policy
# Configure password policy Set-GPRegistryValue -Name "Security Settings" -Key "HKLM\Software\Microsoft\Windows\CurrentVersion\Policies\System" -ValueName "MaximumPasswordAge" -Type DWord -Value 30
-
Lockout Policy
- Computer Configuration → Policies → Windows Settings → Security Settings → Account Policies → Account Lockout Policy
-
Audit Policy
- Computer Configuration → Policies → Windows Settings → Security Settings → Local Policies → Audit Policy
-
Software Restriction
- Computer Configuration → Policies → Windows Settings → Security Settings → Software Restriction Policies
-
Force Policy Update
# Force update on local computer gpupdate /force # Force update on remote computer Invoke-GPUpdate -Computer "Server1" -Force
-
View Applied Policies
# Get applied GPOs gpresult /r # Generate HTML report gpresult /h C:\Reports\GPReport.html /f
-
Configure Policy Processing
# Configure slow link detection Set-GPRegistryValue -Name "Policy Processing" -Key "HKLM\Software\Policies\Microsoft\Windows\System\GroupPolicy" -ValueName "SlowLinkDetectionEnabled" -Type DWord -Value 1
-
Back Up GPOs
# Back up all GPOs Backup-GPO -All -Path "C:\GPOBackups" -Comment "Full Backup $(Get-Date)" # Back up specific GPO Backup-GPO -Name "Security Settings" -Path "C:\GPOBackups"
-
Restore GPOs
# Restore a specific GPO Restore-GPO -Name "Security Settings" -Path "C:\GPOBackups\{GUID}"
-
Import/Export Settings
# Export GPO settings Export-GPO -Name "Security Settings" -Path "C:\GPOExports" # Import GPO settings Import-GPO -BackupId {GUID} -TargetName "New Security Settings" -Path "C:\GPOBackups"
-
GPO Delegation
# Set delegation permissions Set-GPPermission -Name "Security Settings" -TargetName "CONTOSO\IT Admins" -TargetType Group -PermissionLevel GpoEditDeleteModifySecurity
-
Create WMI Filters
# Create WMI filter for Windows 10 computers $wmif = New-ADObject -Name "Windows 10 Computers" -Type "msWMI-Som" -Path "CN=SOM,CN=WMIPolicy,CN=System,DC=contoso,DC=com" -OtherAttributes @{"msWMI-Name"="Windows 10 Computers";"msWMI-Parm1"="Select * from Win32_OperatingSystem WHERE Version LIKE '10.%'";"msWMI-Author"="Administrator";"msWMI-ID"="{$((New-Guid).Guid)}"} -PassThru
-
Install WSUS Role
# Install WSUS role with Management Tools Install-WindowsFeature -Name UpdateServices, UpdateServices-UI -IncludeManagementTools
-
Post-Installation Configuration
# Configure WSUS post-installation & "C:\Program Files\Update Services\Tools\WsusUtil.exe" postinstall CONTENT_DIR=D:\WSUS
-
Configure WSUS Server Settings
# Use PowerShell to configure WSUS $wsus = Get-WsusServer $wsusConfig = $wsus.GetConfiguration() # Configure sync schedule $wsusConfig.SyncScheduleEnabled = $true $wsusConfig.SynchronizeAutomatically = $true $wsusConfig.SynchronizeAutomaticallyTimeOfDay = (New-TimeSpan -Hours 3) $wsusConfig.Save()
-
Select Products and Classifications
# Get WSUS server $wsus = Get-WsusServer # Get update categories $wsusConfig = $wsus.GetSubscription() # Configure products to update $products = @("Windows Server 2022", "Windows Server 2019", "Windows 10") # Clear current product selections $wsusConfig.SetUpdateCategories(@()) # Get available products $allProducts = $wsus.GetUpdateCategories() # Select products $selectedProducts = $allProducts | Where-Object {$_.Title -in $products} # Set selected products $wsusConfig.SetUpdateCategories($selectedProducts) # Configure update classifications $wsusConfig.SetUpdateClassifications(@("Critical Updates", "Security Updates", "Service Packs")) # Save configuration $wsusConfig.Save()
-
Synchronize Updates
# Start synchronization $wsus.GetSubscription().StartSynchronization() # Check synchronization status $wsus.GetSubscription().GetSynchronizationStatus()
-
Configure Automatic Synchronization
# Enable automatic synchronization $wsusConfig = $wsus.GetSubscription() $wsusConfig.SynchronizeAutomatically = $true $wsusConfig.SynchronizeAutomaticallyTimeOfDay = (New-TimeSpan -Hours 1) $wsusConfig.NumberOfSynchronizationsPerDay = 24 $wsusConfig.Save()
-
Enable Client-Side Targeting
# Get WSUS server $wsus = Get-WsusServer # Get configuration $wsusConfig = $wsus.GetConfiguration() # Enable client-side targeting $wsusConfig.TargetingMode = "Client" $wsusConfig.Save()
-
Create Computer Groups
# Create computer groups $wsus.CreateComputerTargetGroup("Production Servers") $wsus.CreateComputerTargetGroup("Test Servers") $wsus.CreateComputerTargetGroup("Workstations")
-
Configure Group Policy for Client Targeting
# Create GPO for WSUS targeting New-GPO -Name "WSUS Client Settings" | New-GPLink -Target "DC=contoso,DC=com" # Configure GPO settings Set-GPRegistryValue -Name "WSUS Client Settings" -Key "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" -ValueName "WUServer" -Type String -Value "http://wsus.contoso.com:8530" Set-GPRegistryValue -Name "WSUS Client Settings" -Key "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" -ValueName "WUStatusServer" -Type String -Value "http://wsus.contoso.com:8530" Set-GPRegistryValue -Name "WSUS Client Settings" -Key "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" -ValueName "NoAutoUpdate" -Type DWord -Value 0 Set-GPRegistryValue -Name "WSUS Client Settings" -Key "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" -ValueName "AUOptions" -Type DWord -Value 4 Set-GPRegistryValue -Name "WSUS Client Settings" -Key "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" -ValueName "TargetGroupEnabled" -Type DWord -Value 1 Set-GPRegistryValue -Name "WSUS Client Settings" -Key "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" -ValueName "TargetGroup" -Type String -Value "Production Servers"
-
Review Available Updates
# Get all updates $wsus = Get-WsusServer $allUpdates = $wsus.GetUpdates() # Get updates that haven't been approved $notApprovedUpdates = $allUpdates | Where-Object {-not $_.IsApproved}
-
Approve Updates for Installation
# Approve critical updates for Production Servers $criticalUpdates = $allUpdates | Where-Object {$_.UpdateClassificationTitle -eq "Critical Updates" -and -not $_.IsApproved} $productionGroup = $wsus.GetComputerTargetGroups() | Where-Object {$_.Name -eq "Production Servers"} foreach ($update in $criticalUpdates) { $update.Approve("Install", $productionGroup) }
-
Decline Superseded Updates
# Decline superseded updates $supersededUpdates = $allUpdates | Where-Object {$_.IsSuperseded -and -not $_.IsDeclined} foreach ($update in $supersededUpdates) { $update.Decline() }
-
Check Update Status
# Get update status $wsus = Get-WsusServer $updateStatus = $wsus.GetSummariesPerUpdate() # Get computers that need updates $computersNeedingUpdates = $wsus.GetComputerTargets() | Where-Object {$_.GetUpdateInstallationSummary().NotInstalledCount -gt 0}
-
Generate Reports
# Generate status report $reportFolder = "C:\Reports" if (-not (Test-Path $reportFolder)) { New-Item -ItemType Directory -Path $reportFolder } $report = @() foreach ($computer in $wsus.GetComputerTargets()) { $summary = $computer.GetUpdateInstallationSummary() $report += [PSCustomObject]@{ ComputerName = $computer.FullDomainName IPAddress = $computer.IPAddress LastReported = $computer.LastReportedStatusTime InstalledCount = $summary.InstalledCount FailedCount = $summary.FailedCount NotInstalledCount = $summary.NotInstalledCount } } $report | Export-Csv -Path "$reportFolder\UpdateReport.csv" -NoTypeInformation
-
Clean Up WSUS
# Run WSUS cleanup wizard $wsusCleanup = $wsus.GetCleanupManager() $wsusCleanup.PerformCleanup($true, $true, $true, $true, $true)
-
Install RDS Core Components
# Install RD Connection Broker Install-WindowsFeature -Name RDS-Connection-Broker -IncludeManagementTools # Install RD Web Access Install-WindowsFeature -Name RDS-Web-Access -IncludeManagementTools # Install RD Session Host Install-WindowsFeature -Name RDS-RD-Server -IncludeManagementTools
-
Deploy Using Server Manager
- Open Server Manager
- Select "Add Roles and Features"
- Choose "Remote Desktop Services installation"
- Select deployment type:
- Standard: Multiple servers for each role
- Quick Start: Single server for all roles
-
Deploy Using PowerShell
# Deploy RDS farm with PowerShell New-RDSessionDeployment -ConnectionBroker "rdcb.contoso.com" -WebAccessServer "rdwa.contoso.com" -SessionHost "rdsh1.contoso.com","rdsh2.contoso.com"
-
Create a Session Collection
# Create a collection for task workers New-RDSessionCollection -CollectionName "TaskWorkers" -SessionHost "rdsh1.contoso.com","rdsh2.contoso.com" -ConnectionBroker "rdcb.contoso.com"
-
Configure Collection Properties
# Set user logon settings Set-RDSessionCollectionConfiguration -CollectionName "TaskWorkers" -ConnectionBroker "rdcb.contoso.com" -UserGroup "CONTOSO\Task Workers" -DisconnectedSessionLimitMin 60 -IdleSessionLimitMin 60 # Configure RDP properties Set-RDSessionCollectionConfiguration -CollectionName "TaskWorkers" -ConnectionBroker "rdcb.contoso.com" -ClientDeviceRedirectionOptions "AudioVideoPlayBack,AudioRecording,Clipboard,Drives,Printers"
-
Configure RemoteApp Programs
# Add applications to collection New-RDRemoteApp -CollectionName "TaskWorkers" -ConnectionBroker "rdcb.contoso.com" -DisplayName "Microsoft Word" -FilePath "C:\Program Files\Microsoft Office\root\Office16\WINWORD.EXE" New-RDRemoteApp -CollectionName "TaskWorkers" -ConnectionBroker "rdcb.contoso.com" -DisplayName "Microsoft Excel" -FilePath "C:\Program Files\Microsoft Office\root\Office16\EXCEL.EXE"
-
Install Required Components
# Install Hyper-V Install-WindowsFeature -Name Hyper-V -IncludeManagementTools # Install RD Virtualization Host Install-WindowsFeature -Name RDS-Virtualization -IncludeManagementTools
-
Create a VDI Deployment
# Add RD Virtualization Host role Add-RDVirtualizationHostServer -VirtualizationHost "vhost.contoso.com" -ConnectionBroker "rdcb.contoso.com"
-
Create a Pooled Virtual Desktop Collection
# Create a pooled VDI collection New-RDVirtualDesktopCollection -CollectionName "PooledVDI" -PooledManaged -VirtualDesktopTemplate "Win10Template" -VirtualDesktopTemplateStoragePath "C:\VHDs" -ConnectionBroker "rdcb.contoso.com" -VirtualizationHost "vhost.contoso.com"
-
Create a Personal Virtual Desktop Collection
# Create a personal VDI collection New-RDVirtualDesktopCollection -CollectionName "PersonalVDI" -PersonalUnmanaged -ConnectionBroker "rdcb.contoso.com" -VirtualizationHost "vhost.contoso.com"
-
Install RD Gateway Role
# Install RD Gateway role Install-WindowsFeature -Name RDS-Gateway -IncludeManagementTools
-
Configure RD Gateway
# Add RD Gateway to deployment Add-RDServer -Server "rdgw.contoso.com" -Role "RDS-GATEWAY" -ConnectionBroker "rdcb.contoso.com" # Configure Gateway properties Set-RDDeploymentGatewayConfiguration -GatewayMode Custom -GatewayExternalFqdn "gateway.contoso.com" -LogonMethod Password -UseCachedCredentials $true -BypassLocal $true -ConnectionBroker "rdcb.contoso.com"
-
Create Authorization Policies
# Create CAP (Connection Authorization Policy) New-RDGatewayCAP -Name "RDG CAP" -UserGroups "CONTOSO\RDS Users" -GatewayServer "rdgw.contoso.com" # Create RAP (Resource Authorization Policy) New-RDGatewayRAP -Name "RDG RAP" -ResourceGroup "CONTOSO\RDS Servers" -ComputerGroupType Domain -GatewayServer "rdgw.contoso.com"
-
Install RD Licensing Role
# Install RD Licensing role Install-WindowsFeature -Name RDS-Licensing -IncludeManagementTools
-
Configure RD Licensing Server
# Add RD Licensing to deployment Add-RDServer -Server "rdls.contoso.com" -Role "RDS-LICENSING" -ConnectionBroker "rdcb.contoso.com" # Set licensing mode Set-RDLicenseConfiguration -LicenseServer "rdls.contoso.com" -Mode PerUser -ConnectionBroker "rdcb.contoso.com"
-
Activate Licensing Server
# Activate via UI: Remote Desktop Licensing Manager # No direct PowerShell cmdlet available for activation
-
Configure Connection Broker HA
# Set up RD Connection Broker HA Set-RDConnectionBrokerHighAvailability -DatabaseConnectionString "DRIVER=SQL Server Native Client 11.0;SERVER=sql.contoso.com;Trusted_Connection=Yes;APP=Remote Desktop Services Connection Broker;DATABASE=RDCBDatabase" -DatabaseFilePath "\\fileserver\RDSConfig\RDCB.mdf" -ClientAccessName "rdcb.contoso.com"
-
Add Secondary Connection Broker
# Add a secondary Connection Broker Add-RDServer -Server "rdcb2.contoso.com" -Role "RDS-CONNECTION-BROKER" -ConnectionBroker "rdcb.contoso.com"
-
Configure Session Host HA
# Add additional Session Hosts Add-RDServer -Server "rdsh3.contoso.com" -Role "RDS-RD-SERVER" -ConnectionBroker "rdcb.contoso.com" # Configure session host load balancing Set-RDSessionCollectionConfiguration -CollectionName "TaskWorkers" -ConnectionBroker "rdcb.contoso.com" -LoadBalancing Level -SessionHost "rdsh1.contoso.com","rdsh2.contoso.com","rdsh3.contoso.com"
-
Install Container Feature
# Install containers feature Install-WindowsFeature -Name Containers
-
Install Docker
# Configure package provider Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force # Install Docker provider Install-Module -Name DockerMsftProvider -Repository PSGallery -Force # Install Docker package Install-Package -Name Docker -ProviderName DockerMsftProvider -Force # Restart computer Restart-Computer -Force
-
Configure Docker Service
# Start Docker service Start-Service Docker # Configure Docker to start automatically Set-Service -Name Docker -StartupType Automatic
-
Download Windows Container Images
# List available images docker images # Pull Windows Server Core image docker pull mcr.microsoft.com/windows/servercore:ltsc2022 # Pull Nano Server image docker pull mcr.microsoft.com/windows/nanoserver:ltsc2022 # Pull Windows image docker pull mcr.microsoft.com/windows:ltsc2022
-
View Downloaded Images
# List all images docker images
-
Create a Container
# Run a container interactively docker run -it mcr.microsoft.com/windows/servercore:ltsc2022 cmd # Run a detached container docker run -d --name web1 -p 80:80 mcr.microsoft.com/windows/servercore/iis:windowsservercore-ltsc2022
-
Manage Container Lifecycle
# List running containers docker ps # List all containers docker ps -a # Stop a container docker stop web1 # Start a container docker start web1 # Remove a container docker rm web1
-
Container Networking
# Create a Docker network docker network create --driver nat contoso-net # Run container on specific network docker run -d --name web2 --network contoso-net -p 8080:80 mcr.microsoft.com/windows/servercore/iis:windowsservercore-ltsc2022 # Inspect container networking docker network inspect contoso-net
-
Create a Dockerfile
# Create a directory for your project mkdir C:\Docker\webapp cd C:\Docker\webapp # Create a Dockerfile notepad Dockerfile -
Sample Dockerfile Contents
FROM mcr.microsoft.com/windows/servercore/iis:windowsservercore-ltsc2022 # Install ASP.NET RUN powershell -Command Add-WindowsFeature Web-Asp-Net45 # Copy application files COPY . /inetpub/wwwroot # Set working directory WORKDIR /inetpub/wwwroot # Expose port 80 EXPOSE 80 # Start IIS ENTRYPOINT ["C:\\ServiceMonitor.exe", "w3svc"]
-
Build the Docker Image
# Build image docker build -t contoso/webapp:v1 . # Verify image docker images
-
Run the Custom Container
# Run the container docker run -d --name webapp -p 80:80 contoso/webapp:v1 # Check if container is running docker ps
-
Install Kubernetes on Windows
# Install Kubernetes CLI (kubectl) Invoke-WebRequest -Uri "https://dl.k8s.io/release/v1.25.0/bin/windows/amd64/kubectl.exe" -OutFile "C:\Windows\System32\kubectl.exe"
-
Connect to a Kubernetes Cluster
# Set Kubernetes configuration $env:KUBECONFIG = "C:\Users\Administrator\.kube\config" # Test connection kubectl cluster-info
-
Deploy a Windows Container to Kubernetes
# Create a deployment YAML file @" apiVersion: apps/v1 kind: Deployment metadata: name: iis-deployment labels: app: iis spec: replicas: 3 selector: matchLabels: app: iis template: metadata: labels: app: iis spec: containers: - name: iis image: mcr.microsoft.com/windows/servercore/iis:windowsservercore-ltsc2022 ports: - containerPort: 80 "@ | Out-File -FilePath "iis-deployment.yaml" # Apply the deployment kubectl apply -f iis-deployment.yaml
-
Download Windows Admin Center
# Download Windows Admin Center Invoke-WebRequest -UseBasicParsing -Uri https://aka.ms/WACDownload -OutFile "$env:USERPROFILE\Downloads\WindowsAdminCenter.msi"
-
Install Windows Admin Center
# Install Windows Admin Center Start-Process msiexec.exe -ArgumentList "/i $env:USERPROFILE\Downloads\WindowsAdminCenter.msi /qn /L*v log.txt SME_PORT=443 SSL_CERTIFICATE_OPTION=generate" -Wait
-
Configure HTTPS
# Create and install a self-signed certificate $cert = New-SelfSignedCertificate -DnsName "adminserver.contoso.com" -CertStoreLocation "cert:\LocalMachine\My" # Export certificate Export-Certificate -Cert $cert -FilePath "C:\Certificates\admincenter.cer"
-
Add Servers to Windows Admin Center
- Open Windows Admin Center (https://localhost or https://servername)
- Click "Add" under "All connections"
- Choose "Add server connection"
- Enter server name or IP address
- Choose authentication method
-
Create a Server Group
- Click "Add" under "All connections"
- Choose "Add server group"
- Name the group and add servers
-
Manage Connection Credentials
- Click on "Settings" (gear icon)
- Select "User Accounts"
- Configure saved credentials
-
Overview Dashboard
- Connect to a server
- View system information, performance, and events
-
Managing Server Roles and Features
- Navigate to "Roles & Features"
- Install or remove roles and features
-
Managing Certificates
- Navigate to "Certificates"
- View, create, and manage certificates
-
Managing Storage
- Navigate to "Storage"
- Manage volumes, disks, and shares
-
Managing Hyper-V
- Navigate to "Virtual Machines"
- Create, configure, and manage VMs
-
Using PowerShell Tools
- Navigate to "PowerShell"
- Run PowerShell commands directly on the remote server
-
Script Library
- Navigate to "PowerShell" > "Script Library"
- Save and run common scripts
-
Install Extensions
- Navigate to "Settings" > "Extensions"
- Browse available extensions
- Install required extensions
-
Update Windows Admin Center
- Navigate to "Settings" > "About"
- Check for updates and install if available
-
PowerShell Execution Policy
# Check current execution policy Get-ExecutionPolicy # Set execution policy Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
-
PowerShell Modules
# List available modules Get-Module -ListAvailable # Import a module Import-Module ServerManager # Find commands in a module Get-Command -Module ServerManager
-
Remote PowerShell Sessions
# Enable PowerShell remoting (run on target server) Enable-PSRemoting -Force # Create a remote session $session = New-PSSession -ComputerName "Server1" # Run commands on remote session Invoke-Command -Session $session -ScriptBlock { Get-Service | Where-Object { $_.Status -eq "Running" } } # Enter interactive session Enter-PSSession -ComputerName "Server1"
-
Managing Server Roles and Features
# Get installed roles and features Get-WindowsFeature | Where-Object {$_.Installed -eq $true} # Install a role or feature Install-WindowsFeature -Name DHCP -IncludeManagementTools # Remove a role or feature Uninstall-WindowsFeature -Name Web-Server
-
Managing Services
# Get service status Get-Service -Name DHCP # Start a service Start-Service -Name DHCP # Stop a service Stop-Service -Name DHCP # Configure service startup type Set-Service -Name DHCP -StartupType Automatic
-
Managing Scheduled Tasks
# Create a scheduled task $action = New-ScheduledTaskAction -Execute "PowerShell.exe" -Argument "-File C:\Scripts\Backup.ps1" $trigger = New-ScheduledTaskTrigger -Daily -At 3am Register-ScheduledTask -Action $action -Trigger $trigger -TaskName "Daily Backup" -Description "Daily backup task" # Get scheduled tasks Get-ScheduledTask | Where-Object {$_.TaskName -like "*Backup*"} # Disable a scheduled task Disable-ScheduledTask -TaskName "Daily Backup"