大佬教程收集整理的这篇文章主要介绍了如何在WDS部署的专门化传递期间运行PowerShell脚本?,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
这是我的无人参与文件的相关部分:
<setTings pass="specialize"> <component name="Microsoft-Windows-Deployment" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://scheR_609_11845@as.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLscheR_609_11845@a-instance"> <RunSynchronous> <RunSynchronousCommand wcm:action="add"> <Order>1</Order> <Credentials> <Domain>WDSSERVER</Domain> <password>ApassworD</password> <Username>AUSERNAME</Username> </Credentials> <Path>"c:\windows\system32\windowspowersHell\v1.0\powersHell.exe" -executionpolicy unreStricted -command "\\<REMOTESERVER>\reminst\customize\specialize.ps1"</Path> </RunSynchronousCommand> </RunSynchronous> </component> </setTings>
响应来自kce的请求.这是脚本本身:
write-host "ExecuTing customisation script." write-host "enabling powersHell script execution" Set-ExecutionPolicy UnreStricted write-host "Bringing non-system disks online..." Get-Disk | Where-Object IsOffline –Eq $True | Set-Disk –IsOffline $false Set-Disk -number 1 -IsReadOnly $false Set-Disk -number 2 -IsReadOnly $false write-host "SetTing up NTP..." W32tm /register start-service w32time w32tm /config /manualpeerlist:uk.pool.ntp.org restart-service w32time Set-service W32Time -StartupType Automatic sc triggerinfo w32time start/networkon stop/networkoff sc config W32Time start=auto write-host "Determining system RAM and setTing pagefile..." $RAM = Get-WmiObject -Class Win32_OperatingSystem | SELEct @R_650_10586@lVisibleMemorySize $RAM = ($RAm.@R_650_10586@lVisibleMemorySize / 1kb).toString("F00") write-host "disable automanage" wmic computersystem set AutomaticManagedPagefile=false Write-Host "removing old pagefile" wmic pagefileset delete write-host "creaTing new pagefile on E:\" wmic pagefileset create name=“e:\pagefile.sys” write-host "set size" $PageFile = Get-WmiObject -Class Win32_PageFileSetTing $PageFile.InitialSize = $RAM $PageFile.MaximumSize = $RAM [void]$PageFile.Put() write-host "Disabling Windows Firewall..." netsh advfirewall set allprofiles state off write-host "Enabling powersHell remoTing..." Enable-PSRemoTing -Force write-host "SorTing out remote management trusted hosts..." winrm s winrm/config/client '@{TrustedHosts="*"}' write-host "Disabling Windows error reporTing..." Disable-WindowsErrorReporTing write-host "Installing VMware Tools..." c:\vmware-tools.exe /S /v"/qn"
"powersHell.exe" -executionpolicy bypass -noprofile -file "\\<REMOTESERVER>\reminst\customize\specialize.ps1"
实际上是有效的,假设它运行的帐户具有文件共享的权限.要避免这些权限问题,您只需将代码粘贴到{}之间的答案文件中,然后使用-command选项,
"powersHell.exe" -executionpolicy bypass -noprofile -command {...}
以上是大佬教程为你收集整理的如何在WDS部署的专门化传递期间运行PowerShell脚本?全部内容,希望文章能够帮你解决如何在WDS部署的专门化传递期间运行PowerShell脚本?所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。