private dynamic GetNodeState(ServerConfig server)
        {
            var nodeCheckExecutor = new PowerShellExecutor();
            var nodeCheckResult   =
                nodeCheckExecutor.Execute(server,
                                          string.Format("Get-ConDepNodeState \"{0}\" \"{1}\"", _destPath, FileHashGenerator.GetFileHash(_srcPath)),
                                          mod =>
            {
                mod.LoadConDepModule     = false;
                mod.LoadConDepNodeModule = true;
            },
                                          logOutput: true);

            return(nodeCheckResult.Single(psObject => psObject.ConDepResult != null).ConDepResult);
        }
        private bool NeedToDeployScript(ServerConfig server, string localFile)
        {
            const string script = @"Param($fileWithHash, $dir)
$dir = $ExecutionContext.InvokeCommand.ExpandString($dir)

$conDepReturnValues = New-Object PSObject -Property @{         
    ConDepResult    = New-Object PSObject -Property @{
		Files = $null
    }                 
}                  

function Get-ConDepFileHash($path) {
    if(Test-Path $path) {
        $md5 = [System.Security.Cryptography.MD5]::Create()
        $hash = [System.BitConverter]::ToString($md5.ComputeHash([System.IO.File]::ReadAllBytes($path)))
        return $hash.Replace(""-"", """")
    }
    else {
        return """"
    }
}

$returnValues = @()

$hash = Get-ConDepFileHash (Join-Path -path $dir -childpath $($fileWithHash.Item1))
$returnValues += @{
	FileName = $fileWithHash.Item1
	IsEqual = ($hash -eq $fileWithHash.Item2)
}

$conDepReturnValues.ConDepResult.Files = $returnValues
return $conDepReturnValues
";

            var scriptParameters = new List <CommandParameter>
            {
                new CommandParameter("fileWithHash", new Tuple <string, string>(Path.GetFileName(localFile), FileHashGenerator.GetFileHash(localFile))),
                new CommandParameter("dir", server.GetServerInfo().ConDepNodeScriptsFolder)
            };

            var scriptResult = _psExecutor.Execute(server, script, opt => opt.LoadConDepModule = false, logOutput: false, parameters: scriptParameters);

            foreach (var psObject in scriptResult)
            {
                if (psObject.ConDepResult == null || psObject.ConDepResult.Files == null)
                {
                    continue;
                }

                var remoteFilesArray = ((PSObject)psObject.ConDepResult.Files).BaseObject as ArrayList;
                var remoteFiles      = remoteFilesArray.Cast <dynamic>().Select(remoteFile => remoteFile);

                return(remoteFiles.Any(remoteFile => !remoteFile.IsEqual && remoteFile.FileName == Path.GetFileName(localFile)));
            }

            return(false);
        }