{"action":"created","comment":{"url":"https://api.github.com/repos/Azure/azure-devtestlab/pulls/comments/41414939","id":41414939,"diff_hunk":"@@ -0,0 +1,262 @@\n+﻿<##################################################################################################\n+\n+    Description\n+    ===========\n+\n+\t- This script does the following - \n+\t\t- installs chocolatey\n+\t\t- installs specified chocolatey packages\n+\n+\t- This script generates logs in the following folder - \n+\t\t- %ALLUSERSPROFILE%\\ChocolateyPackageInstaller-{TimeStamp}\\Logs folder.\n+\n+\n+    Usage examples\n+    ==============\n+    \n+    Powershell -executionpolicy bypass -file ChocolateyPackageInstaller.ps1\n+\n+\n+    Pre-Requisites\n+    ==============\n+\n+    - Ensure that the powershell execution policy is set to unrestricted (@TODO).\n+\n+\n+    Known issues / Caveats\n+    ======================\n+    \n+    - No known issues.\n+\n+\n+    Coming soon / planned work\n+    ==========================\n+\n+    - N/A.    \n+\n+##################################################################################################>\n+\n+#\n+# Optional arguments to this script file.\n+#\n+\n+Param(\n+    # comma or semicolon separated list of chocolatey packages.\n+    [ValidateNotNullOrEmpty()]\n+    [string]\n+    $RawPackagesList\n+)\n+\n+##################################################################################################\n+\n+#\n+# Powershell Configurations\n+#\n+\n+# Note: Because the $ErrorActionPreference is \"Stop\", this script will stop on first failure.  \n+$ErrorActionPreference = \"stop\"\n+\n+###################################################################################################\n+\n+#\n+# Custom Configurations\n+#\n+\n+$ChocolateyPackageInstallerFolder = Join-Path $env:ALLUSERSPROFILE -ChildPath $(\"ChocolateyPackageInstaller-\" + [System.DateTime]::Now.ToString(\"yyyy-MM-dd-HH-mm-ss\"))\n+\n+# Location of the log files\n+$ScriptLog = Join-Path -Path $ChocolateyPackageInstallerFolder -ChildPath \"ChocolateyPackageInstaller.log\"\n+$ChocolateyInstallLog = Join-Path -Path $ChocolateyPackageInstallerFolder -ChildPath \"ChocolateyInstall.log\"\n+\n+##################################################################################################\n+\n+# \n+# Description:\n+#  - Displays the script argument values (default or user-supplied).\n+#\n+# Parameters:\n+#  - N/A.\n+#\n+# Return:\n+#  - N/A.\n+#\n+# Notes:\n+#  - Please ensure that the Initialize() method has been called at least once before this \n+#    method. Else this method can only write to console and not to log files. \n+#\n+\n+function DisplayArgValues\n+{\n+    WriteLog \"========== Configuration ==========\"\n+    WriteLog $(\"RawPackagesList : \" + $RawPackagesList)\n+    WriteLog \"========== Configuration ==========\"\n+}\n+\n+##################################################################################################\n+\n+# \n+# Description:\n+#  - Creates the folder structure which'll be used for dumping logs generated by this script and\n+#    the logon task.\n+#\n+# Parameters:\n+#  - N/A.\n+#\n+# Return:\n+#  - N/A.\n+#\n+# Notes:\n+#  - N/A.\n+#\n+\n+function InitializeFolders\n+{\n+    if ($false -eq (Test-Path -Path $ChocolateyPackageInstallerFolder))\n+    {\n+        New-Item -Path $ChocolateyPackageInstallerFolder -ItemType directory | Out-Null\n+    }\n+}\n+\n+##################################################################################################\n+\n+# \n+# Description:\n+#  - Writes specified string to the console as well as to the script log (indicated by $ScriptLog).\n+#\n+# Parameters:\n+#  - $message: The string to write.\n+#\n+# Return:\n+#  - N/A.\n+#\n+# Notes:\n+#  - N/A.\n+#\n+\n+function WriteLog\n+{\n+    Param(\n+        <# Can be null or empty #> $message\n+    )\n+\n+    $timestampedMessage = $(\"[\" + [System.DateTime]::Now + \"] \" + $message) | % {  \n+        Write-Host -Object $_\n+        Out-File -InputObject $_ -FilePath $ScriptLog -Append\n+    }\n+}\n+\n+##################################################################################################\n+\n+# \n+# Description:\n+#  - Installs the chocolatey package manager.\n+#\n+# Parameters:\n+#  - N/A.\n+#\n+# Return:\n+#  - If installation is successful, then nothing is returned.\n+#  - Else a detailed terminating error is thrown.\n+#\n+# Notes:\n+#  - @TODO: Write to $chocolateyInstallLog log file.\n+#  - @TODO: Currently no errors are being written to the log file ($chocolateyInstallLog). This needs to be fixed.\n+#\n+\n+function InstallChocolatey\n+{\n+    Param(\n+        [ValidateNotNullOrEmpty()] $chocolateyInstallLog\n+    )\n+\n+    WriteLog \"Installing Chocolatey...\"\n+\n+    Invoke-Expression ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1')) | Out-Null\n+\n+    WriteLog \"Success.\"\n+}\n+\n+##################################################################################################\n+\n+#\n+# Description:\n+#  - Installs the specified chocolatet packages on the machine.\n+#\n+# Parameters:\n+#  - N/A.\n+#\n+# Return:\n+#  - N/A.\n+#\n+# Notes:\n+#  - N/A.\n+#\n+\n+function InstallPackages\n+{\n+    Param(\n+        [ValidateNotNullOrEmpty()][string] $packagesList\n+    )\n+\n+    $Separator = @(\";\",\",\")","path":"Artifacts/windows-7zip/ChocolateyPackageInstaller.ps1","position":201,"original_position":201,"commit_id":"622bc57eb929b007fd42165b7ad2728c5fbb4697","original_commit_id":"622bc57eb929b007fd42165b7ad2728c5fbb4697","user":{"login":"drwill-ms","id":14119884,"avatar_url":"https://avatars.githubusercontent.com/u/14119884?v=3","gravatar_id":"","url":"https://api.github.com/users/drwill-ms","html_url":"https://github.com/drwill-ms","followers_url":"https://api.github.com/users/drwill-ms/followers","following_url":"https://api.github.com/users/drwill-ms/following{/other_user}","gists_url":"https://api.github.com/users/drwill-ms/gists{/gist_id}","starred_url":"https://api.github.com/users/drwill-ms/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/drwill-ms/subscriptions","organizations_url":"https://api.github.com/users/drwill-ms/orgs","repos_url":"https://api.github.com/users/drwill-ms/repos","events_url":"https://api.github.com/users/drwill-ms/events{/privacy}","received_events_url":"https://api.github.com/users/drwill-ms/received_events","type":"User","site_admin":false},"body":"minor: consistent casing for local variables","created_at":"2015-10-07T16:48:31Z","updated_at":"2015-10-07T16:48:31Z","html_url":"https://github.com/Azure/azure-devtestlab/pull/12#discussion_r41414939","pull_request_url":"https://api.github.com/repos/Azure/azure-devtestlab/pulls/12","_links":{"self":{"href":"https://api.github.com/repos/Azure/azure-devtestlab/pulls/comments/41414939"},"html":{"href":"https://github.com/Azure/azure-devtestlab/pull/12#discussion_r41414939"},"pull_request":{"href":"https://api.github.com/repos/Azure/azure-devtestlab/pulls/12"}}},"pull_request":{"url":"https://api.github.com/repos/Azure/azure-devtestlab/pulls/12","id":47050197,"html_url":"https://github.com/Azure/azure-devtestlab/pull/12","diff_url":"https://github.com/Azure/azure-devtestlab/pull/12.diff","patch_url":"https://github.com/Azure/azure-devtestlab/pull/12.patch","issue_url":"https://api.github.com/repos/Azure/azure-devtestlab/issues/12","number":12,"state":"open","locked":false,"title":"add artifacts to install several different chocolatey artifacts","user":{"login":"mmydland","id":522137,"avatar_url":"https://avatars.githubusercontent.com/u/522137?v=3","gravatar_id":"","url":"https://api.github.com/users/mmydland","html_url":"https://github.com/mmydland","followers_url":"https://api.github.com/users/mmydland/followers","following_url":"https://api.github.com/users/mmydland/following{/other_user}","gists_url":"https://api.github.com/users/mmydland/gists{/gist_id}","starred_url":"https://api.github.com/users/mmydland/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mmydland/subscriptions","organizations_url":"https://api.github.com/users/mmydland/orgs","repos_url":"https://api.github.com/users/mmydland/repos","events_url":"https://api.github.com/users/mmydland/events{/privacy}","received_events_url":"https://api.github.com/users/mmydland/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-10-07T16:29:27Z","updated_at":"2015-10-07T16:48:32Z","closed_at":null,"merged_at":null,"merge_commit_sha":"cb525e1ef316ff392c534d0bfdf3e9b384f2c626","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Azure/azure-devtestlab/pulls/12/commits","review_comments_url":"https://api.github.com/repos/Azure/azure-devtestlab/pulls/12/comments","review_comment_url":"https://api.github.com/repos/Azure/azure-devtestlab/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Azure/azure-devtestlab/issues/12/comments","statuses_url":"https://api.github.com/repos/Azure/azure-devtestlab/statuses/622bc57eb929b007fd42165b7ad2728c5fbb4697","head":{"label":"Azure:chocoArtifacts","ref":"chocoArtifacts","sha":"622bc57eb929b007fd42165b7ad2728c5fbb4697","user":{"login":"Azure","id":6844498,"avatar_url":"https://avatars.githubusercontent.com/u/6844498?v=3","gravatar_id":"","url":"https://api.github.com/users/Azure","html_url":"https://github.com/Azure","followers_url":"https://api.github.com/users/Azure/followers","following_url":"https://api.github.com/users/Azure/following{/other_user}","gists_url":"https://api.github.com/users/Azure/gists{/gist_id}","starred_url":"https://api.github.com/users/Azure/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Azure/subscriptions","organizations_url":"https://api.github.com/users/Azure/orgs","repos_url":"https://api.github.com/users/Azure/repos","events_url":"https://api.github.com/users/Azure/events{/privacy}","received_events_url":"https://api.github.com/users/Azure/received_events","type":"Organization","site_admin":false},"repo":{"id":42144605,"name":"azure-devtestlab","full_name":"Azure/azure-devtestlab","owner":{"login":"Azure","id":6844498,"avatar_url":"https://avatars.githubusercontent.com/u/6844498?v=3","gravatar_id":"","url":"https://api.github.com/users/Azure","html_url":"https://github.com/Azure","followers_url":"https://api.github.com/users/Azure/followers","following_url":"https://api.github.com/users/Azure/following{/other_user}","gists_url":"https://api.github.com/users/Azure/gists{/gist_id}","starred_url":"https://api.github.com/users/Azure/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Azure/subscriptions","organizations_url":"https://api.github.com/users/Azure/orgs","repos_url":"https://api.github.com/users/Azure/repos","events_url":"https://api.github.com/users/Azure/events{/privacy}","received_events_url":"https://api.github.com/users/Azure/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Azure/azure-devtestlab","description":"Azure DevTestLab artifacts, scripts and samples","fork":false,"url":"https://api.github.com/repos/Azure/azure-devtestlab","forks_url":"https://api.github.com/repos/Azure/azure-devtestlab/forks","keys_url":"https://api.github.com/repos/Azure/azure-devtestlab/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Azure/azure-devtestlab/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Azure/azure-devtestlab/teams","hooks_url":"https://api.github.com/repos/Azure/azure-devtestlab/hooks","issue_events_url":"https://api.github.com/repos/Azure/azure-devtestlab/issues/events{/number}","events_url":"https://api.github.com/repos/Azure/azure-devtestlab/events","assignees_url":"https://api.github.com/repos/Azure/azure-devtestlab/assignees{/user}","branches_url":"https://api.github.com/repos/Azure/azure-devtestlab/branches{/branch}","tags_url":"https://api.github.com/repos/Azure/azure-devtestlab/tags","blobs_url":"https://api.github.com/repos/Azure/azure-devtestlab/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Azure/azure-devtestlab/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Azure/azure-devtestlab/git/refs{/sha}","trees_url":"https://api.github.com/repos/Azure/azure-devtestlab/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Azure/azure-devtestlab/statuses/{sha}","languages_url":"https://api.github.com/repos/Azure/azure-devtestlab/languages","stargazers_url":"https://api.github.com/repos/Azure/azure-devtestlab/stargazers","contributors_url":"https://api.github.com/repos/Azure/azure-devtestlab/contributors","subscribers_url":"https://api.github.com/repos/Azure/azure-devtestlab/subscribers","subscription_url":"https://api.github.com/repos/Azure/azure-devtestlab/subscription","commits_url":"https://api.github.com/repos/Azure/azure-devtestlab/commits{/sha}","git_commits_url":"https://api.github.com/repos/Azure/azure-devtestlab/git/commits{/sha}","comments_url":"https://api.github.com/repos/Azure/azure-devtestlab/comments{/number}","issue_comment_url":"https://api.github.com/repos/Azure/azure-devtestlab/issues/comments{/number}","contents_url":"https://api.github.com/repos/Azure/azure-devtestlab/contents/{+path}","compare_url":"https://api.github.com/repos/Azure/azure-devtestlab/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Azure/azure-devtestlab/merges","archive_url":"https://api.github.com/repos/Azure/azure-devtestlab/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Azure/azure-devtestlab/downloads","issues_url":"https://api.github.com/repos/Azure/azure-devtestlab/issues{/number}","pulls_url":"https://api.github.com/repos/Azure/azure-devtestlab/pulls{/number}","milestones_url":"https://api.github.com/repos/Azure/azure-devtestlab/milestones{/number}","notifications_url":"https://api.github.com/repos/Azure/azure-devtestlab/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Azure/azure-devtestlab/labels{/name}","releases_url":"https://api.github.com/repos/Azure/azure-devtestlab/releases{/id}","created_at":"2015-09-08T23:32:52Z","updated_at":"2015-10-06T20:45:44Z","pushed_at":"2015-10-07T16:29:27Z","git_url":"git://github.com/Azure/azure-devtestlab.git","ssh_url":"git@github.com:Azure/azure-devtestlab.git","clone_url":"https://github.com/Azure/azure-devtestlab.git","svn_url":"https://github.com/Azure/azure-devtestlab","homepage":null,"size":1493,"stargazers_count":2,"watchers_count":2,"language":"PowerShell","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":2,"default_branch":"master"}},"base":{"label":"Azure:master","ref":"master","sha":"947691f955f3c54cafe9793dcb43f871f3a2301e","user":{"login":"Azure","id":6844498,"avatar_url":"https://avatars.githubusercontent.com/u/6844498?v=3","gravatar_id":"","url":"https://api.github.com/users/Azure","html_url":"https://github.com/Azure","followers_url":"https://api.github.com/users/Azure/followers","following_url":"https://api.github.com/users/Azure/following{/other_user}","gists_url":"https://api.github.com/users/Azure/gists{/gist_id}","starred_url":"https://api.github.com/users/Azure/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Azure/subscriptions","organizations_url":"https://api.github.com/users/Azure/orgs","repos_url":"https://api.github.com/users/Azure/repos","events_url":"https://api.github.com/users/Azure/events{/privacy}","received_events_url":"https://api.github.com/users/Azure/received_events","type":"Organization","site_admin":false},"repo":{"id":42144605,"name":"azure-devtestlab","full_name":"Azure/azure-devtestlab","owner":{"login":"Azure","id":6844498,"avatar_url":"https://avatars.githubusercontent.com/u/6844498?v=3","gravatar_id":"","url":"https://api.github.com/users/Azure","html_url":"https://github.com/Azure","followers_url":"https://api.github.com/users/Azure/followers","following_url":"https://api.github.com/users/Azure/following{/other_user}","gists_url":"https://api.github.com/users/Azure/gists{/gist_id}","starred_url":"https://api.github.com/users/Azure/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Azure/subscriptions","organizations_url":"https://api.github.com/users/Azure/orgs","repos_url":"https://api.github.com/users/Azure/repos","events_url":"https://api.github.com/users/Azure/events{/privacy}","received_events_url":"https://api.github.com/users/Azure/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Azure/azure-devtestlab","description":"Azure DevTestLab artifacts, scripts and samples","fork":false,"url":"https://api.github.com/repos/Azure/azure-devtestlab","forks_url":"https://api.github.com/repos/Azure/azure-devtestlab/forks","keys_url":"https://api.github.com/repos/Azure/azure-devtestlab/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Azure/azure-devtestlab/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Azure/azure-devtestlab/teams","hooks_url":"https://api.github.com/repos/Azure/azure-devtestlab/hooks","issue_events_url":"https://api.github.com/repos/Azure/azure-devtestlab/issues/events{/number}","events_url":"https://api.github.com/repos/Azure/azure-devtestlab/events","assignees_url":"https://api.github.com/repos/Azure/azure-devtestlab/assignees{/user}","branches_url":"https://api.github.com/repos/Azure/azure-devtestlab/branches{/branch}","tags_url":"https://api.github.com/repos/Azure/azure-devtestlab/tags","blobs_url":"https://api.github.com/repos/Azure/azure-devtestlab/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Azure/azure-devtestlab/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Azure/azure-devtestlab/git/refs{/sha}","trees_url":"https://api.github.com/repos/Azure/azure-devtestlab/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Azure/azure-devtestlab/statuses/{sha}","languages_url":"https://api.github.com/repos/Azure/azure-devtestlab/languages","stargazers_url":"https://api.github.com/repos/Azure/azure-devtestlab/stargazers","contributors_url":"https://api.github.com/repos/Azure/azure-devtestlab/contributors","subscribers_url":"https://api.github.com/repos/Azure/azure-devtestlab/subscribers","subscription_url":"https://api.github.com/repos/Azure/azure-devtestlab/subscription","commits_url":"https://api.github.com/repos/Azure/azure-devtestlab/commits{/sha}","git_commits_url":"https://api.github.com/repos/Azure/azure-devtestlab/git/commits{/sha}","comments_url":"https://api.github.com/repos/Azure/azure-devtestlab/comments{/number}","issue_comment_url":"https://api.github.com/repos/Azure/azure-devtestlab/issues/comments{/number}","contents_url":"https://api.github.com/repos/Azure/azure-devtestlab/contents/{+path}","compare_url":"https://api.github.com/repos/Azure/azure-devtestlab/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Azure/azure-devtestlab/merges","archive_url":"https://api.github.com/repos/Azure/azure-devtestlab/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Azure/azure-devtestlab/downloads","issues_url":"https://api.github.com/repos/Azure/azure-devtestlab/issues{/number}","pulls_url":"https://api.github.com/repos/Azure/azure-devtestlab/pulls{/number}","milestones_url":"https://api.github.com/repos/Azure/azure-devtestlab/milestones{/number}","notifications_url":"https://api.github.com/repos/Azure/azure-devtestlab/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Azure/azure-devtestlab/labels{/name}","releases_url":"https://api.github.com/repos/Azure/azure-devtestlab/releases{/id}","created_at":"2015-09-08T23:32:52Z","updated_at":"2015-10-06T20:45:44Z","pushed_at":"2015-10-07T16:29:27Z","git_url":"git://github.com/Azure/azure-devtestlab.git","ssh_url":"git@github.com:Azure/azure-devtestlab.git","clone_url":"https://github.com/Azure/azure-devtestlab.git","svn_url":"https://github.com/Azure/azure-devtestlab","homepage":null,"size":1493,"stargazers_count":2,"watchers_count":2,"language":"PowerShell","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Azure/azure-devtestlab/pulls/12"},"html":{"href":"https://github.com/Azure/azure-devtestlab/pull/12"},"issue":{"href":"https://api.github.com/repos/Azure/azure-devtestlab/issues/12"},"comments":{"href":"https://api.github.com/repos/Azure/azure-devtestlab/issues/12/comments"},"review_comments":{"href":"https://api.github.com/repos/Azure/azure-devtestlab/pulls/12/comments"},"review_comment":{"href":"https://api.github.com/repos/Azure/azure-devtestlab/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Azure/azure-devtestlab/pulls/12/commits"},"statuses":{"href":"https://api.github.com/repos/Azure/azure-devtestlab/statuses/622bc57eb929b007fd42165b7ad2728c5fbb4697"}}}}