avhimkov
6/12/2017 - 6:11 PM

Install PK PVD

Install PK PVD


$PAthEXE="$env:userprofile\AppData\Local\Programs\ПК ПВД (клиент)\Pvd\SRCC.Terra.PVD.Reception.exe"
$PathConfig="$env:userprofile\AppData\Local\ООО_«ЭйТи_Консалтинг»\SRCC.Terra.PVD.Reception.*\2.20.11*\user.config"
$Version="2.20.11.3235"
If (Test-Path $PAthEXE){
    Write-Output "File PVD.exe exists"
    If (Test-Path $PathConfig){
        Write-Output "File user.config exists"
        $ResolvPath = Resolve-Path $PathConfig
        $xml = New-Object XML
        $xml.Load($ResolvPath)
        
        $element =  $xml.SelectSingleNode('//*[@name="SRCC.Terra.PVD.Windows.Tasks.Logon.PVDLogonDialog.WindowsUser"]/value')
        $element.InnerText = "False"
        #$element.InnerText = "True"
        
        $element =  $xml.SelectSingleNode('//*[@name="SRCC.Terra.PVD.Windows.Tasks.Logon.PVDLogonDialog.Server"]/value')
        $element.InnerText = "192.168.10.200"
        
        $element =  $xml.SelectSingleNode('//*[@name="SRCC.Terra.PVD.Windows.Tasks.Logon.PVDLogonDialog.User"]/value')
        $element.InnerText = "AvhimkovDL"
        
        $xml.Save($ResolvPath)
        
        
    }Else{
        Write-Output "File user.config does not exist"
       
    }
        
}Else{
    Write-Output "File PVD.exe does not exist"
    $FolderPath = Resolve-Path "$env:userprofile\AppData\Local\ООО_«ЭйТи_Консалтинг»\SRCC.Terra.PVD.Reception.*\2.20.11.3235"
    $ResolvPath = Resolve-Path "$env:userprofile\AppData\Local\ООО_«ЭйТи_Консалтинг»\SRCC.Terra.PVD.Reception.*\2.20.11*\"
    
    $pathPVD = {C:\install\PVD.exe /verysilent}
    Invoke-Command -ScriptBlock $pathPVD
    Start-Sleep 5
    Stop-Process -processname SRCC.Terra.PVD.Reception*
    
    if (Test-Path $ResolvPath){
        Write-Output "File Folder exist"
        Copy-Item -Path "C:\install\user.config" -Destination $ResolvPath
    }Else{
        Write-Output "File Folder exist"
        New-Item -ItemType directory $FolderPath 
        #Write-Output $ResolvPath
        Copy-Item -Path "C:\install\user.config" -Destination $ResolvPath
        }
}