Friday, August 15, 2014

Powershell - Setup BGinfo

$a = $env:COMPUTERNAME.substring(1,1)

$bgprod = "%SYSTEMDRIVE%\BIN\BGInfo\BgInfo.exe %SYSTEMDRIVE%\Bin\BGINFO\Prod.bgi /timer:0 /log:%SYSTEMDRIVE%\Bin\BGINFO\BgInfo.log /accepteula"

$bgnonprod = "%SYSTEMDRIVE%\BIN\BGInfo\BgInfo.exe %SYSTEMDRIVE%\Bin\BGINFO\NonProd.bgi /timer:0 /log:%SYSTEMDRIVE%\Bin\BGINFO\BgInfo.log /accepteula"

Set-Location -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\

if ($a -eq "p")



{

New-ItemProperty -Path . -Name BGINFO -PropertyType String -Value $bgprod

} else {

New-ItemProperty -Path . -Name BGINFO -PropertyType String -Value $bgnonprod



}

No comments: