powershell-3.0

PowerShell : retrieve file from GitHub

孤街醉人 提交于 2020-12-01 12:57:14
问题 I need to download a file from my GitHub private repo. So following the instructions on the GitHub site, I created an OAuth token for my credentials. Then I executed this PS script : $WebClient = New-Object -TypeName System.Net.WebClient $WebClient.Headers.Add('Authorization','{OAuth token}') $uri = "https://github.com/mycompany/myrepo/blob/master/myfile.zip" $targetPath = "c:\temp" $WebClient.DownloadFile($uri, $targetPath) However, $WebClient.DownloadFile() returns a 404. This is strange

PowerShell : retrieve file from GitHub

拟墨画扇 提交于 2020-12-01 12:52:21
问题 I need to download a file from my GitHub private repo. So following the instructions on the GitHub site, I created an OAuth token for my credentials. Then I executed this PS script : $WebClient = New-Object -TypeName System.Net.WebClient $WebClient.Headers.Add('Authorization','{OAuth token}') $uri = "https://github.com/mycompany/myrepo/blob/master/myfile.zip" $targetPath = "c:\temp" $WebClient.DownloadFile($uri, $targetPath) However, $WebClient.DownloadFile() returns a 404. This is strange

How to handle dots in powershell commands?

自作多情 提交于 2020-08-24 10:41:13
问题 The command below works in command line mvn clean install -Denunciate.skip But breaks in powershell with the error [ERROR] Unknown lifecycle phase ".skip". You must specify a valid lifecycle phase or a goal in the format 回答1: Using quotes can help, especially with actual PowerShell code. However you are just trying to use a regular command. You can keep the PowerShell parser from misinterpreting your code by using the stop-parsing parameter The stop-parsing symbol ( --% ), introduced in

Issues with Powershell Invoke-Command

橙三吉。 提交于 2020-08-23 06:56:08
问题 I am trying to get an application to install on a remote server using powershell. Here is the script I am using: $cred = Get-Credential $s = New-PSSession -ComputerName $ServerName -Credential $cred Invoke-Command -Session $s -ScriptBlock {Start-Process -FilePath "c:\windows\system32\msiexec.exe" -ArgumentList "/i \\computer\e$\installer.msi /qn" -Wait} Remove-PSSession -ComputerName $ServerName If I run the following on the remote computer directly, it executes beautifully: Start-Process

New-AzADAppCredential Generate Client Secret

喜欢而已 提交于 2020-08-11 03:13:10
问题 Is there a way to generate a password client secret using the New-AzADAppCredential cmdlet? I don't want to supply the password to the cmdlet and would much rather use the generate one much like the Azure Portal. 回答1: I am afraid you can't, when using New-AzADAppCredential to create client secret, the -Password is needed. The workaround is to use the New-AzureADApplicationPasswordCredential command in AzureAD module. New-AzureADApplicationPasswordCredential -ObjectId "<object-id>" 回答2: Not