{"action":"created","comment":{"url":"https://api.github.com/repos/Microsoft/vso-agent-tasks/pulls/comments/34337810","id":34337810,"diff_hunk":"@@ -606,13 +627,56 @@ function InvokeDTAExecHostExe([string] $Version, [System.Management.Automation.P\n     }\n     $exePath = Join-Path -Path $vsRoot -ChildPath $ExeName\n     $exePath = \"'\" + $exePath + \"'\"\n+\tTry\n+\t{\n+\t\t$StartDate = New-Object -TypeName DateTime -ArgumentList:(2050,01,01)\n+\t\t$FormatHack = ($([System.Globalization.DateTimeFormatInfo]::CurrentInfo.ShortDatePattern) -replace 'M+/', 'MM/') -replace 'd+/', 'dd/'\n+\t    $date1 = $StartDate.ToString($FormatHack)               \n+\t\t\n+      \t$session = CreateNewSession -MachineCredential $MachineCredential\n+\t\tInvoke-Command -Session $session -ErrorAction Continue -ErrorVariable err -OutVariable out -scriptBlock { schtasks.exe /create /TN:DTAConfig /TR:$args[0] /F /RL:HIGHEST /SD $args[1] /SC:ONCE /ST:00:00 ; schtasks.exe /run /TN:DTAConfig } -ArgumentList $exePath,$date1\n+\n+\t\tWrite-Verbose (\"Error : {0} \" -f ($err | out-string)) -Verbose\n+\t\tWrite-Verbose (\"Output : {0} \" -f ($out | out-string)) -Verbose\n+\t}\n+    Catch\n+    {\n+        Write-Verbose -Message (\"Unable to start Agent process, will be rebooting the machine to complete the configuration\") -Verbose\n+    }\n+   \n+}\n \n-    $session = New-PSSession -ComputerName . -Credential $MachineCredential\n-    Invoke-Command -Session $session -ErrorAction Continue -ErrorVariable err -OutVariable out -scriptBlock { schtasks.exe /create /TN:DTAConfig /TR:$args /F /RL:HIGHEST /SD:01/01/2050 /SC:ONCE /ST:00:00 ; schtasks.exe /run /TN:DTAConfig } -ArgumentList $exePath\n-\n-    Write-Verbose (\"Error : {0} \" -f ($err | out-string)) -Verbose\n-    Write-Verbose (\"Output : {0} \" -f ($out | out-string)) -Verbose\n-\n+function CreateNewSession( [System.Management.Automation.PSCredential] $MachineCredentials)\n+{   \n+\t$winrmconfigDetails = Winrm e  winrm/config/listener -format:pretty |Out-String  \n+\t$xmldoc = [XML]$winrmconfigDetails      \n+\t$transports = $xmldoc.GetElementsByTagName(\"cfg:Transport\")  \n+\t$ports = $xmldoc.GetElementsByTagName(\"cfg:Port\")  \n+\n+\tif( $ports -ne $null -and  $transports -ne $null -and $ports.Count -gt 0)  \n+\t{  \n+\t\t$port = $ports[0].InnerText  \n+\t\t$transport = $transports[0].InnerText  \n+\t}  \n+\telse  \n+\t{  \n+\t\tWrite-Verbose -Message(\"Unable to fetch WinRM config details. Using default port for configuration\") -Verbose  \n+\t\t$port = 5985  \n+\t\t$transport = HTTP            \n+\t}  ","path":"Tasks/DeployVisualStudioTestAgent/TestAgentConfiguration.ps1","position":81,"original_position":81,"commit_id":"2111c11dbda8984d4db18ac4cb6b8ea5a6ee883f","original_commit_id":"2111c11dbda8984d4db18ac4cb6b8ea5a6ee883f","user":{"login":"pavanadepu1","id":12247075,"avatar_url":"https://avatars.githubusercontent.com/u/12247075?v=3","gravatar_id":"","url":"https://api.github.com/users/pavanadepu1","html_url":"https://github.com/pavanadepu1","followers_url":"https://api.github.com/users/pavanadepu1/followers","following_url":"https://api.github.com/users/pavanadepu1/following{/other_user}","gists_url":"https://api.github.com/users/pavanadepu1/gists{/gist_id}","starred_url":"https://api.github.com/users/pavanadepu1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pavanadepu1/subscriptions","organizations_url":"https://api.github.com/users/pavanadepu1/orgs","repos_url":"https://api.github.com/users/pavanadepu1/repos","events_url":"https://api.github.com/users/pavanadepu1/events{/privacy}","received_events_url":"https://api.github.com/users/pavanadepu1/received_events","type":"User","site_admin":false},"body":"This might break if http is not configured at all on the machine.\r\n","created_at":"2015-07-10T08:58:42Z","updated_at":"2015-07-10T08:58:42Z","html_url":"https://github.com/Microsoft/vso-agent-tasks/pull/312#discussion_r34337810","pull_request_url":"https://api.github.com/repos/Microsoft/vso-agent-tasks/pulls/312","_links":{"self":{"href":"https://api.github.com/repos/Microsoft/vso-agent-tasks/pulls/comments/34337810"},"html":{"href":"https://github.com/Microsoft/vso-agent-tasks/pull/312#discussion_r34337810"},"pull_request":{"href":"https://api.github.com/repos/Microsoft/vso-agent-tasks/pulls/312"}}},"pull_request":{"url":"https://api.github.com/repos/Microsoft/vso-agent-tasks/pulls/312","id":39475725,"html_url":"https://github.com/Microsoft/vso-agent-tasks/pull/312","diff_url":"https://github.com/Microsoft/vso-agent-tasks/pull/312.diff","patch_url":"https://github.com/Microsoft/vso-agent-tasks/pull/312.patch","issue_url":"https://api.github.com/repos/Microsoft/vso-agent-tasks/issues/312","number":312,"state":"open","locked":false,"title":"Bug 363595:Configuring Agent with Interactive process is failing in HTTPS","user":{"login":"aditya-MSFT","id":11919396,"avatar_url":"https://avatars.githubusercontent.com/u/11919396?v=3","gravatar_id":"","url":"https://api.github.com/users/aditya-MSFT","html_url":"https://github.com/aditya-MSFT","followers_url":"https://api.github.com/users/aditya-MSFT/followers","following_url":"https://api.github.com/users/aditya-MSFT/following{/other_user}","gists_url":"https://api.github.com/users/aditya-MSFT/gists{/gist_id}","starred_url":"https://api.github.com/users/aditya-MSFT/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aditya-MSFT/subscriptions","organizations_url":"https://api.github.com/users/aditya-MSFT/orgs","repos_url":"https://api.github.com/users/aditya-MSFT/repos","events_url":"https://api.github.com/users/aditya-MSFT/events{/privacy}","received_events_url":"https://api.github.com/users/aditya-MSFT/received_events","type":"User","site_admin":false},"body":"Bug 363595:Configuring Agent with Interactive process is failing in HTTPS\r\n\r\n1. Getting details of WinRm configuration on the machine\r\n2. Making sure we are using correct parameters while launching new PSSession for DTAExecutionHost","created_at":"2015-07-08T13:19:24Z","updated_at":"2015-07-10T08:58:42Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a0996c5be0f72929a9507561663369dc525bd59c","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Microsoft/vso-agent-tasks/pulls/312/commits","review_comments_url":"https://api.github.com/repos/Microsoft/vso-agent-tasks/pulls/312/comments","review_comment_url":"https://api.github.com/repos/Microsoft/vso-agent-tasks/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Microsoft/vso-agent-tasks/issues/312/comments","statuses_url":"https://api.github.com/repos/Microsoft/vso-agent-tasks/statuses/2111c11dbda8984d4db18ac4cb6b8ea5a6ee883f","head":{"label":"Microsoft:users/aditya/m85hotfix363595","ref":"users/aditya/m85hotfix363595","sha":"2111c11dbda8984d4db18ac4cb6b8ea5a6ee883f","user":{"login":"Microsoft","id":6154722,"avatar_url":"https://avatars.githubusercontent.com/u/6154722?v=3","gravatar_id":"","url":"https://api.github.com/users/Microsoft","html_url":"https://github.com/Microsoft","followers_url":"https://api.github.com/users/Microsoft/followers","following_url":"https://api.github.com/users/Microsoft/following{/other_user}","gists_url":"https://api.github.com/users/Microsoft/gists{/gist_id}","starred_url":"https://api.github.com/users/Microsoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Microsoft/subscriptions","organizations_url":"https://api.github.com/users/Microsoft/orgs","repos_url":"https://api.github.com/users/Microsoft/repos","events_url":"https://api.github.com/users/Microsoft/events{/privacy}","received_events_url":"https://api.github.com/users/Microsoft/received_events","type":"Organization","site_admin":false},"repo":{"id":27631673,"name":"vso-agent-tasks","full_name":"Microsoft/vso-agent-tasks","owner":{"login":"Microsoft","id":6154722,"avatar_url":"https://avatars.githubusercontent.com/u/6154722?v=3","gravatar_id":"","url":"https://api.github.com/users/Microsoft","html_url":"https://github.com/Microsoft","followers_url":"https://api.github.com/users/Microsoft/followers","following_url":"https://api.github.com/users/Microsoft/following{/other_user}","gists_url":"https://api.github.com/users/Microsoft/gists{/gist_id}","starred_url":"https://api.github.com/users/Microsoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Microsoft/subscriptions","organizations_url":"https://api.github.com/users/Microsoft/orgs","repos_url":"https://api.github.com/users/Microsoft/repos","events_url":"https://api.github.com/users/Microsoft/events{/privacy}","received_events_url":"https://api.github.com/users/Microsoft/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Microsoft/vso-agent-tasks","description":"","fork":false,"url":"https://api.github.com/repos/Microsoft/vso-agent-tasks","forks_url":"https://api.github.com/repos/Microsoft/vso-agent-tasks/forks","keys_url":"https://api.github.com/repos/Microsoft/vso-agent-tasks/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Microsoft/vso-agent-tasks/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Microsoft/vso-agent-tasks/teams","hooks_url":"https://api.github.com/repos/Microsoft/vso-agent-tasks/hooks","issue_events_url":"https://api.github.com/repos/Microsoft/vso-agent-tasks/issues/events{/number}","events_url":"https://api.github.com/repos/Microsoft/vso-agent-tasks/events","assignees_url":"https://api.github.com/repos/Microsoft/vso-agent-tasks/assignees{/user}","branches_url":"https://api.github.com/repos/Microsoft/vso-agent-tasks/branches{/branch}","tags_url":"https://api.github.com/repos/Microsoft/vso-agent-tasks/tags","blobs_url":"https://api.github.com/repos/Microsoft/vso-agent-tasks/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Microsoft/vso-agent-tasks/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Microsoft/vso-agent-tasks/git/refs{/sha}","trees_url":"https://api.github.com/repos/Microsoft/vso-agent-tasks/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Microsoft/vso-agent-tasks/statuses/{sha}","languages_url":"https://api.github.com/repos/Microsoft/vso-agent-tasks/languages","stargazers_url":"https://api.github.com/repos/Microsoft/vso-agent-tasks/stargazers","contributors_url":"https://api.github.com/repos/Microsoft/vso-agent-tasks/contributors","subscribers_url":"https://api.github.com/repos/Microsoft/vso-agent-tasks/subscribers","subscription_url":"https://api.github.com/repos/Microsoft/vso-agent-tasks/subscription","commits_url":"https://api.github.com/repos/Microsoft/vso-agent-tasks/commits{/sha}","git_commits_url":"https://api.github.com/repos/Microsoft/vso-agent-tasks/git/commits{/sha}","comments_url":"https://api.github.com/repos/Microsoft/vso-agent-tasks/comments{/number}","issue_comment_url":"https://api.github.com/repos/Microsoft/vso-agent-tasks/issues/comments{/number}","contents_url":"https://api.github.com/repos/Microsoft/vso-agent-tasks/contents/{+path}","compare_url":"https://api.github.com/repos/Microsoft/vso-agent-tasks/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Microsoft/vso-agent-tasks/merges","archive_url":"https://api.github.com/repos/Microsoft/vso-agent-tasks/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Microsoft/vso-agent-tasks/downloads","issues_url":"https://api.github.com/repos/Microsoft/vso-agent-tasks/issues{/number}","pulls_url":"https://api.github.com/repos/Microsoft/vso-agent-tasks/pulls{/number}","milestones_url":"https://api.github.com/repos/Microsoft/vso-agent-tasks/milestones{/number}","notifications_url":"https://api.github.com/repos/Microsoft/vso-agent-tasks/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Microsoft/vso-agent-tasks/labels{/name}","releases_url":"https://api.github.com/repos/Microsoft/vso-agent-tasks/releases{/id}","created_at":"2014-12-06T11:11:46Z","updated_at":"2015-07-07T12:54:29Z","pushed_at":"2015-07-10T08:48:40Z","git_url":"git://github.com/Microsoft/vso-agent-tasks.git","ssh_url":"git@github.com:Microsoft/vso-agent-tasks.git","clone_url":"https://github.com/Microsoft/vso-agent-tasks.git","svn_url":"https://github.com/Microsoft/vso-agent-tasks","homepage":"","size":6511,"stargazers_count":59,"watchers_count":59,"language":"PowerShell","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":22,"mirror_url":null,"open_issues_count":25,"forks":22,"open_issues":25,"watchers":59,"default_branch":"master"}},"base":{"label":"Microsoft:releases/m85","ref":"releases/m85","sha":"ba71e88dbceded891f3939f143604792f86d6ff6","user":{"login":"Microsoft","id":6154722,"avatar_url":"https://avatars.githubusercontent.com/u/6154722?v=3","gravatar_id":"","url":"https://api.github.com/users/Microsoft","html_url":"https://github.com/Microsoft","followers_url":"https://api.github.com/users/Microsoft/followers","following_url":"https://api.github.com/users/Microsoft/following{/other_user}","gists_url":"https://api.github.com/users/Microsoft/gists{/gist_id}","starred_url":"https://api.github.com/users/Microsoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Microsoft/subscriptions","organizations_url":"https://api.github.com/users/Microsoft/orgs","repos_url":"https://api.github.com/users/Microsoft/repos","events_url":"https://api.github.com/users/Microsoft/events{/privacy}","received_events_url":"https://api.github.com/users/Microsoft/received_events","type":"Organization","site_admin":false},"repo":{"id":27631673,"name":"vso-agent-tasks","full_name":"Microsoft/vso-agent-tasks","owner":{"login":"Microsoft","id":6154722,"avatar_url":"https://avatars.githubusercontent.com/u/6154722?v=3","gravatar_id":"","url":"https://api.github.com/users/Microsoft","html_url":"https://github.com/Microsoft","followers_url":"https://api.github.com/users/Microsoft/followers","following_url":"https://api.github.com/users/Microsoft/following{/other_user}","gists_url":"https://api.github.com/users/Microsoft/gists{/gist_id}","starred_url":"https://api.github.com/users/Microsoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Microsoft/subscriptions","organizations_url":"https://api.github.com/users/Microsoft/orgs","repos_url":"https://api.github.com/users/Microsoft/repos","events_url":"https://api.github.com/users/Microsoft/events{/privacy}","received_events_url":"https://api.github.com/users/Microsoft/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Microsoft/vso-agent-tasks","description":"","fork":false,"url":"https://api.github.com/repos/Microsoft/vso-agent-tasks","forks_url":"https://api.github.com/repos/Microsoft/vso-agent-tasks/forks","keys_url":"https://api.github.com/repos/Microsoft/vso-agent-tasks/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Microsoft/vso-agent-tasks/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Microsoft/vso-agent-tasks/teams","hooks_url":"https://api.github.com/repos/Microsoft/vso-agent-tasks/hooks","issue_events_url":"https://api.github.com/repos/Microsoft/vso-agent-tasks/issues/events{/number}","events_url":"https://api.github.com/repos/Microsoft/vso-agent-tasks/events","assignees_url":"https://api.github.com/repos/Microsoft/vso-agent-tasks/assignees{/user}","branches_url":"https://api.github.com/repos/Microsoft/vso-agent-tasks/branches{/branch}","tags_url":"https://api.github.com/repos/Microsoft/vso-agent-tasks/tags","blobs_url":"https://api.github.com/repos/Microsoft/vso-agent-tasks/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Microsoft/vso-agent-tasks/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Microsoft/vso-agent-tasks/git/refs{/sha}","trees_url":"https://api.github.com/repos/Microsoft/vso-agent-tasks/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Microsoft/vso-agent-tasks/statuses/{sha}","languages_url":"https://api.github.com/repos/Microsoft/vso-agent-tasks/languages","stargazers_url":"https://api.github.com/repos/Microsoft/vso-agent-tasks/stargazers","contributors_url":"https://api.github.com/repos/Microsoft/vso-agent-tasks/contributors","subscribers_url":"https://api.github.com/repos/Microsoft/vso-agent-tasks/subscribers","subscription_url":"https://api.github.com/repos/Microsoft/vso-agent-tasks/subscription","commits_url":"https://api.github.com/repos/Microsoft/vso-agent-tasks/commits{/sha}","git_commits_url":"https://api.github.com/repos/Microsoft/vso-agent-tasks/git/commits{/sha}","comments_url":"https://api.github.com/repos/Microsoft/vso-agent-tasks/comments{/number}","issue_comment_url":"https://api.github.com/repos/Microsoft/vso-agent-tasks/issues/comments{/number}","contents_url":"https://api.github.com/repos/Microsoft/vso-agent-tasks/contents/{+path}","compare_url":"https://api.github.com/repos/Microsoft/vso-agent-tasks/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Microsoft/vso-agent-tasks/merges","archive_url":"https://api.github.com/repos/Microsoft/vso-agent-tasks/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Microsoft/vso-agent-tasks/downloads","issues_url":"https://api.github.com/repos/Microsoft/vso-agent-tasks/issues{/number}","pulls_url":"https://api.github.com/repos/Microsoft/vso-agent-tasks/pulls{/number}","milestones_url":"https://api.github.com/repos/Microsoft/vso-agent-tasks/milestones{/number}","notifications_url":"https://api.github.com/repos/Microsoft/vso-agent-tasks/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Microsoft/vso-agent-tasks/labels{/name}","releases_url":"https://api.github.com/repos/Microsoft/vso-agent-tasks/releases{/id}","created_at":"2014-12-06T11:11:46Z","updated_at":"2015-07-07T12:54:29Z","pushed_at":"2015-07-10T08:48:40Z","git_url":"git://github.com/Microsoft/vso-agent-tasks.git","ssh_url":"git@github.com:Microsoft/vso-agent-tasks.git","clone_url":"https://github.com/Microsoft/vso-agent-tasks.git","svn_url":"https://github.com/Microsoft/vso-agent-tasks","homepage":"","size":6511,"stargazers_count":59,"watchers_count":59,"language":"PowerShell","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":22,"mirror_url":null,"open_issues_count":25,"forks":22,"open_issues":25,"watchers":59,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Microsoft/vso-agent-tasks/pulls/312"},"html":{"href":"https://github.com/Microsoft/vso-agent-tasks/pull/312"},"issue":{"href":"https://api.github.com/repos/Microsoft/vso-agent-tasks/issues/312"},"comments":{"href":"https://api.github.com/repos/Microsoft/vso-agent-tasks/issues/312/comments"},"review_comments":{"href":"https://api.github.com/repos/Microsoft/vso-agent-tasks/pulls/312/comments"},"review_comment":{"href":"https://api.github.com/repos/Microsoft/vso-agent-tasks/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Microsoft/vso-agent-tasks/pulls/312/commits"},"statuses":{"href":"https://api.github.com/repos/Microsoft/vso-agent-tasks/statuses/2111c11dbda8984d4db18ac4cb6b8ea5a6ee883f"}}}}