{"action":"created","issue":{"url":"https://api.github.com/repos/Microsoft/vsts-tasks/issues/2983","repository_url":"https://api.github.com/repos/Microsoft/vsts-tasks","labels_url":"https://api.github.com/repos/Microsoft/vsts-tasks/issues/2983/labels{/name}","comments_url":"https://api.github.com/repos/Microsoft/vsts-tasks/issues/2983/comments","events_url":"https://api.github.com/repos/Microsoft/vsts-tasks/issues/2983/events","html_url":"https://github.com/Microsoft/vsts-tasks/issues/2983","id":186199473,"number":2983,"title":"What is the correct way to debug your scripts in PowerShellOnTargetMachines?","user":{"login":"gregpakes","id":102243,"avatar_url":"https://avatars.githubusercontent.com/u/102243?v=3","gravatar_id":"","url":"https://api.github.com/users/gregpakes","html_url":"https://github.com/gregpakes","followers_url":"https://api.github.com/users/gregpakes/followers","following_url":"https://api.github.com/users/gregpakes/following{/other_user}","gists_url":"https://api.github.com/users/gregpakes/gists{/gist_id}","starred_url":"https://api.github.com/users/gregpakes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gregpakes/subscriptions","organizations_url":"https://api.github.com/users/gregpakes/orgs","repos_url":"https://api.github.com/users/gregpakes/repos","events_url":"https://api.github.com/users/gregpakes/events{/privacy}","received_events_url":"https://api.github.com/users/gregpakes/received_events","type":"User","site_admin":false},"labels":[{"id":391088230,"url":"https://api.github.com/repos/Microsoft/vsts-tasks/labels/Area:%20Release","name":"Area: Release","color":"5319e7","default":false},{"id":154814016,"url":"https://api.github.com/repos/Microsoft/vsts-tasks/labels/question","name":"question","color":"cc317c","default":true}],"state":"open","locked":false,"assignee":{"login":"KrishnaAdityaB","id":14232392,"avatar_url":"https://avatars.githubusercontent.com/u/14232392?v=3","gravatar_id":"","url":"https://api.github.com/users/KrishnaAdityaB","html_url":"https://github.com/KrishnaAdityaB","followers_url":"https://api.github.com/users/KrishnaAdityaB/followers","following_url":"https://api.github.com/users/KrishnaAdityaB/following{/other_user}","gists_url":"https://api.github.com/users/KrishnaAdityaB/gists{/gist_id}","starred_url":"https://api.github.com/users/KrishnaAdityaB/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KrishnaAdityaB/subscriptions","organizations_url":"https://api.github.com/users/KrishnaAdityaB/orgs","repos_url":"https://api.github.com/users/KrishnaAdityaB/repos","events_url":"https://api.github.com/users/KrishnaAdityaB/events{/privacy}","received_events_url":"https://api.github.com/users/KrishnaAdityaB/received_events","type":"User","site_admin":false},"assignees":[{"login":"KrishnaAdityaB","id":14232392,"avatar_url":"https://avatars.githubusercontent.com/u/14232392?v=3","gravatar_id":"","url":"https://api.github.com/users/KrishnaAdityaB","html_url":"https://github.com/KrishnaAdityaB","followers_url":"https://api.github.com/users/KrishnaAdityaB/followers","following_url":"https://api.github.com/users/KrishnaAdityaB/following{/other_user}","gists_url":"https://api.github.com/users/KrishnaAdityaB/gists{/gist_id}","starred_url":"https://api.github.com/users/KrishnaAdityaB/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KrishnaAdityaB/subscriptions","organizations_url":"https://api.github.com/users/KrishnaAdityaB/orgs","repos_url":"https://api.github.com/users/KrishnaAdityaB/repos","events_url":"https://api.github.com/users/KrishnaAdityaB/events{/privacy}","received_events_url":"https://api.github.com/users/KrishnaAdityaB/received_events","type":"User","site_admin":false}],"milestone":null,"comments":6,"created_at":"2016-10-31T04:11:48Z","updated_at":"2016-11-04T15:35:15Z","closed_at":null,"body":"I have a series of Powershell modules that I am executing with PowerShellOnTargetMachines.\r\n\r\nI am trying to see the debug statements within the VSTS build log, but I am having a real hard time getting them to come through.\r\n\r\nI understand that **Write-Host** is not recommended for automation, so my question is, what should I use?  I have tried **Write-Debug**, **Write-Verbose** and made sure the preferences are set right.  But when I call a function from the main script all my logging disappears.  The only output I can get to appear is **Write-Output** from the top most script.  I obviously can't use **Write-Output** from called functions as they may return a value.\r\n\r\nThis is possibly a more generic powershell question, but I am wondering if there are any best practices for use with this task?"},"comment":{"url":"https://api.github.com/repos/Microsoft/vsts-tasks/issues/comments/258464582","html_url":"https://github.com/Microsoft/vsts-tasks/issues/2983#issuecomment-258464582","issue_url":"https://api.github.com/repos/Microsoft/vsts-tasks/issues/2983","id":258464582,"user":{"login":"KrishnaAdityaB","id":14232392,"avatar_url":"https://avatars.githubusercontent.com/u/14232392?v=3","gravatar_id":"","url":"https://api.github.com/users/KrishnaAdityaB","html_url":"https://github.com/KrishnaAdityaB","followers_url":"https://api.github.com/users/KrishnaAdityaB/followers","following_url":"https://api.github.com/users/KrishnaAdityaB/following{/other_user}","gists_url":"https://api.github.com/users/KrishnaAdityaB/gists{/gist_id}","starred_url":"https://api.github.com/users/KrishnaAdityaB/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KrishnaAdityaB/subscriptions","organizations_url":"https://api.github.com/users/KrishnaAdityaB/orgs","repos_url":"https://api.github.com/users/KrishnaAdityaB/repos","events_url":"https://api.github.com/users/KrishnaAdityaB/events{/privacy}","received_events_url":"https://api.github.com/users/KrishnaAdityaB/received_events","type":"User","site_admin":false},"created_at":"2016-11-04T15:35:15Z","updated_at":"2016-11-04T15:35:15Z","body":"@gregpakes \r\nWhat are the versions of agent and PowerShell on Target Machines task you have?\r\n\r\nI am able to get the logs when I tried with agent version 2.109.1,  task version 1.0.43. Below are the sripts\r\n\r\n**verboseModule.psm1**\r\n```\r\nfunction moduleFunction() {\r\n    Write-Verbose \"inside module function\"\r\n}\r\n```\r\n\r\n**script.ps1**\r\n```\r\nWrite-Verbose \"inside parent file\" -Verbose\r\n\r\nImport-Module $PSScriptRoot/verboseModule.psm1\r\nmoduleFunction\r\n```\r\n\r\n**output**\r\n```\r\n\t Deployment started on target machine...\r\n\r\ninside parent file\r\n\r\nLoading module from path 'C:\\temp\\scripts\\verboseModule.psm1'.\r\n\r\nExporting function 'moduleFunction'.\r\n\r\nImporting function 'moduleFunction'.\r\n\r\ninside module function\r\n```\r\n\r\n"}}
{"actor":{"display_login":"KrishnaAdityaB"}}