Public/Functions/OSDCloud/Set-OSDCloudUnattendAuditMode.ps1
function Set-OSDCloudUnattendAuditMode { [CmdletBinding()] param () #================================================= # UnattendXml #================================================= $UnattendXml = @' <?xml version="1.0" encoding="utf-8"?> <unattend xmlns="urn:schemas-microsoft-com:unattend"> <settings pass="specialize"> <component name="Microsoft-Windows-Deployment" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <RunSynchronous> <RunSynchronousCommand wcm:action="add"> <Order>1</Order> <Description>OSDCloud Specialize</Description> <Path>Powershell -ExecutionPolicy Bypass -Command Invoke-OSDSpecialize -Verbose</Path> </RunSynchronousCommand> </RunSynchronous> </component> </settings> <settings pass="oobeSystem"> <component name="Microsoft-Windows-Deployment" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <Reseal> <Mode>Audit</Mode> </Reseal> </component> </settings> </unattend> '@ #================================================= # Block #================================================= Block-WinOS Block-WindowsVersionNe10 Block-PowerShellVersionLt5 #================================================= # Directories #================================================= if (-NOT (Test-Path 'C:\Windows\Panther')) { New-Item -Path 'C:\Windows\Panther'-ItemType Directory -Force -ErrorAction Stop | Out-Null } #================================================= # Panther Unattend #================================================= $Panther = 'C:\Windows\Panther' $UnattendPath = "$Panther\Unattend.xml" Write-Verbose -Verbose "Setting $UnattendPath" $UnattendXml | Out-File -FilePath $UnattendPath -Encoding utf8 -Width 2000 -Force #================================================= # Use-WindowsUnattend #================================================= Write-Verbose -Verbose "Use-WindowsUnattend -Path 'C:\' -UnattendPath $UnattendPath" Use-WindowsUnattend -Path 'C:\' -UnattendPath $UnattendPath -Verbose Notepad $UnattendPath #================================================= } |