start-service Wecsvc
stop-service Wecsvc
$USER ="dosapp"
(Get-Content D:\system.ini) | ForEach-Object { $_-replace "woafont=.+","woafont=$user" } | Set-Content  D:\system.ini
function Set-RegistryValue($key, $name, $value, $type="String") { 
  if ((Test-Path $key) -eq $false) { md $key | Out-Null } 
       Set-ItemProperty $key $name $value -type $type 
  } 
function Get-RegistryValues($key) { 
                 (Get-Item $key).GetValueNames() 
}
原文地址:http://www.cnblogs.com/rosizel/p/3920705.html