From 02efe33b133187209e363a5bf2af12ad4358841c Mon Sep 17 00:00:00 2001 From: Jaap Brasser Date: Sun, 24 May 2020 20:35:59 +0200 Subject: [PATCH 1/2] =?UTF-8?q?Added=20`Invoke-RunAsPowerShell7`=20functio?= =?UTF-8?q?n=20to=20repo=20=F0=9F=9B=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Invoke-RunAsPowerShell7.ps1 | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 Invoke-RunAsPowerShell7/Invoke-RunAsPowerShell7.ps1 diff --git a/Invoke-RunAsPowerShell7/Invoke-RunAsPowerShell7.ps1 b/Invoke-RunAsPowerShell7/Invoke-RunAsPowerShell7.ps1 new file mode 100644 index 0000000..09a0f06 --- /dev/null +++ b/Invoke-RunAsPowerShell7/Invoke-RunAsPowerShell7.ps1 @@ -0,0 +1,34 @@ +function Invoke-RunAsPowerShell7 { +<# +.Synopsis +Run a command in PowerShell 7 + +.DESCRIPTION +Downloads PowerShell 7 from GitHub, expands the archive and runs the specified command in PowerShell 7 + +.NOTES +Name: Invoke-RunAsPowerShell7 +Author: Jaap Brasser +Version: 1.0 +DateUpdated: 2020-05-24 + +.LINK +https://www.jaapbrasser.com + +.EXAMPLE +Invoke-RunAsPowerShell7 -Command '$PSVersionTable' + +Description: +Downloads PowerShell 7 from GitHub, expands the archive and runs the specified command in PowerShell 7 +#> + param( + # The command that will be run in PowerShell 7 + [string] $Command + ) + + [Net.ServicePointManager]::SecurityProtocol = ([Net.ServicePointManager]::SecurityProtocol).tostring() + ', Tls12' + Invoke-WebRequest https://github.com/PowerShell/PowerShell/releases/download/v7.0.1/PowerShell-7.0.1-win-x64.zip -OutFile $env:temp\pwsh.zip + $GUID = (New-Guid).Guid + Expand-Archive $env:temp\pwsh.zip -DestinationPath $env:temp\$guid + & "$env:temp\$guid\pwsh.exe" -c $Command +} \ No newline at end of file From 205f04a7bd11208f812f240b2bf602da55b4734b Mon Sep 17 00:00:00 2001 From: Jaap Brasser Date: Tue, 18 Aug 2020 18:10:31 +0200 Subject: [PATCH 2/2] Added repo to folder name --- Get-GitPullRequestLocal/Get-GitPullRequestLocal.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Get-GitPullRequestLocal/Get-GitPullRequestLocal.ps1 b/Get-GitPullRequestLocal/Get-GitPullRequestLocal.ps1 index eb0c846..651ddca 100644 --- a/Get-GitPullRequestLocal/Get-GitPullRequestLocal.ps1 +++ b/Get-GitPullRequestLocal/Get-GitPullRequestLocal.ps1 @@ -29,7 +29,7 @@ Will create a folder in C:\Temp named after the PR number, and clone the specifi $Request = Invoke-WebRequest $Uri $Values = @{ - Folder = '{0}\PR{1}' -f $Path, (($Uri -replace '\/$').Split('/')[-1]) + Folder = '{0}\{1}_PR{2}' -f $Path, (($Uri -replace '\/$').Split('/')[4]), (($Uri -replace '\/$').Split('/')[-1]) GitHubUri = 'https://github.com/{0}' -f $Request.Links.Where{$_.class -eq 'no-underline'}[1].title.split(':')[0] Branch = $Request.Links.Where{$_.class -eq 'no-underline'}[1].title.split(':')[1] }