I am currently trying to put this script:
https://github.com/VeeamHub/powershell/ ... rapper.ps1
into use in our own environment.
I am running into some odd issues.
I have the following script that works when performing this to the original VM:
Code: Select all
<#
	accepts certifs automatically
#>
param (
    [string]$fexist = "/etc/xattr.conf",
    [string]$plink = "C:\temp\plink.exe",
    [string]$ip = "orginal_vm_ip",
    [string]$username = "xx",
    [string]$password = "xx",
    [int]$timeout = 30
)
#prefix write-host with [linuxfexist] and a second prefix if $p is set (default "")
function write-wrapper {
    param($t, $p = "")
    $a = @($t)
    if ($p -ne "") { $p = "$p " }
    $a | % { if ($_ -ne $null -and $_ -ne "" -and $_.trim() -ne "") {write-host ("{0} {1}{2}" -f $logpref, $p, $_)}}
}
write-wrapper "Testing for $fexist @ $ip"
$exitcode = 1
if (test-path $plink) {
    $fcmd = 'fftest="'+$fexist+'";if [ -e "$fftest" ];then echo "FFEXIST $fftest FFEXIST";else echo "DOES NOT EXIST $fftest";fi'
    $argplink = @("-v", $ip, "-l", $username, "-pw", $password, $fcmd)
    
    $pinfo = New-Object System.Diagnostics.ProcessStartInfo
    $pinfo.FileName = $plink
    $pinfo.RedirectStandardError = $true
    $pinfo.RedirectStandardOutput = $true
    $pinfo.RedirectStandardInput = $true
    $pinfo.UseShellExecute = $false
    $pinfo.Arguments = $argplink
    
    $p = New-Object System.Diagnostics.Process
    $p.StartInfo = $pinfo
    $p.Start() | Out-Null
    
    # Check if the process started successfully
    if ($p -ne $null -and $p.StandardInput -ne $null) {
        $p.StandardInput.Write("yes")
    } else {
        write-wrapper "Process failed to start or StandardInput is null"
        exit 1
    }
    
    while ($timeout -gt 0 -and -not $p.HasExited) {
        start-sleep -Seconds 1
        $timeout--
    }
    
    if ($timeout -gt 0 -and $p.HasExited) {
        $stdout = $p.StandardOutput.ReadToEnd()
        $stderr = $p.StandardError.ReadToEnd()
        
        if ($stdout -ne $null -and $stderr -ne $null) {
            if ($stdout.trim() -eq "FFEXIST $fexist FFEXIST") {
                write-wrapper ("File exists {0}" -f $stdout.trim())
                $exitcode = 0
            } else {
                write-wrapper "Something went wrong, ... dumping"
                write-wrapper -t $stderr.Split("`n") -p "stderr"
                write-wrapper -t $stdout.Split("`n") -p "stdout"
            }
        } else {
            write-wrapper "StandardOutput or StandardError is null"
        }
    } else {
        if ($p -ne $null) {
            $p.Kill()
        }
        write-wrapper "Timeout, ... dumping"
        if ($stderr -ne $null) {
            write-wrapper -t $stderr.Split("`n") -p "stderr"
        }
        if ($stdout -ne $null) {
            write-wrapper -t $stdout.Split("`n") -p "stdout"
        }
    }
} else {
    write-wrapper "$plink path does not exist"
}
exit $exitcode
When I have the application group running, edit the ip in the script to the masked ip I suddenly get timeouts
Code: Select all
PS C:\Windows\system32> C:\temp\linuxcheckfileCopy.ps1
 Testing for /etc/xattr.conf @ original_VM_IP
 File exists FFEXIST /etc/xattr.conf FFEXIST
PS C:\Windows\system32> C:\temp\linuxcheckfileCopy.ps1
 Testing for /etc/xattr.conf @ surebackup_masked_ip
 Timeout, ... dumping
PS C:\Windows\system32>
There is no firewall active on the VBR or restoredVM
Im not sure what im missing.