powershell

Unable to deploy .zip file using Kudu api to the Azure App Service

此生再无相见时 提交于 2020-12-15 06:17:07
问题 I'm using PowerShell inline task in the release pipeline to deploy the respective zip file to the Azure App Service, but im unable to achieve it due to the below error. Can you please let me know if there is any thing that im missing here. I'm getting below error Invoke-RestMethod : Path 'D:\a\r1\a_CI-VI-Maven/DeployPackages/marnet.zip' resolves to a directory. Specify a path including a file name, and then retry the command. Below is the script that im using: $username = "username" $password

Sending keys to an open windows in PowerShell

别等时光非礼了梦想. 提交于 2020-12-15 05:49:27
问题 I made a program that opens a certain program, then Ctrl + C it after x amount of time. I am now using this [System.Windows.Forms.SendKeys]::SendWait("^{c}") . Will this target that certain window or just randomly send it to the current window? How can I change it to a certain window? This is my code: Write-Host "Safe Botting V0.1" Write-Host "Initializing..." Start-Sleep -s 3 Write-Host "Program started successfully with no errors." While($true) { Write-Host "Starting bot..." Start-Sleep -s

PowerShell New-TimeSpan Displayed Friendly with Day(s) Hour(s) Minute(s) Second(s)

谁说我不能喝 提交于 2020-12-15 04:56:46
问题 I've been looking for a PowerShell script similar to examples found in .NET examples. To take a New-TimeSpan and display is at 1 day, 2 hours, 3 minutes, 4 seconds. Exclude where its zero, add plural "s" where needed. Anybody have that handy? This is as far as I got: $StartDate = (Get-Date).ToString("M/dd/yyyy h:mm:ss tt") Write-Host "Start Time: $StartDate" # Do Something $EndDate = (Get-Date).ToString("M/dd/yyyy h:mm:ss tt") Write-Host "End Time: $EndDate" -ForegroundColor Cyan $Duration =

PowerShell New-TimeSpan Displayed Friendly with Day(s) Hour(s) Minute(s) Second(s)

北城以北 提交于 2020-12-15 04:56:12
问题 I've been looking for a PowerShell script similar to examples found in .NET examples. To take a New-TimeSpan and display is at 1 day, 2 hours, 3 minutes, 4 seconds. Exclude where its zero, add plural "s" where needed. Anybody have that handy? This is as far as I got: $StartDate = (Get-Date).ToString("M/dd/yyyy h:mm:ss tt") Write-Host "Start Time: $StartDate" # Do Something $EndDate = (Get-Date).ToString("M/dd/yyyy h:mm:ss tt") Write-Host "End Time: $EndDate" -ForegroundColor Cyan $Duration =

Methods to persist CSV data using PowerShell on Linux?

折月煮酒 提交于 2020-12-15 04:54:59
问题 From Linux, might there be a "native" or built-in convenient "database" facility from withing Powershell itself? While this works fine for importing data: nicholas@mordor:~/csv$ nicholas@mordor:~/csv$ ll BCCDC_COVID19_Dashboard_Lab_Information.csv -rw-rw-r-- 1 nicholas nicholas 89153 Nov 22 05:16 BCCDC_COVID19_Dashboard_Lab_Information.csv nicholas@mordor:~/csv$ nicholas@mordor:~/csv$ pwsh PowerShell 7.1.0 Copyright (c) Microsoft Corporation. https://aka.ms/powershell Type 'help' to get help.

How to pipe downloaded CSV data from Invoke-RestMethod to Import-CSV?

懵懂的女人 提交于 2020-12-15 04:54:51
问题 How can I represent, or at least view, this data? PS /home/nicholas> PS /home/nicholas> $labs='http://www.bccdc.ca/Health-Info-Site/Documents/BCCDC_COVID19_Dashboard_Lab_Information.csv' PS /home/nicholas> PS /home/nicholas> $labs_csv=Invoke-RestMethod -Method Get -Uri $labs -Headers @{"Content-Type" = "text/csv"} PS /home/nicholas> PS /home/nicholas> $labs_csv "Date","Region","New_Tests","Total_Tests","Positivity","Turn_Around" 2020-01-23,"BC",2,2,0,32 2020-01-23,"Fraser",0,0,0,0 2020-01-23,

Methods to persist CSV data using PowerShell on Linux?

三世轮回 提交于 2020-12-15 04:54:47
问题 From Linux, might there be a "native" or built-in convenient "database" facility from withing Powershell itself? While this works fine for importing data: nicholas@mordor:~/csv$ nicholas@mordor:~/csv$ ll BCCDC_COVID19_Dashboard_Lab_Information.csv -rw-rw-r-- 1 nicholas nicholas 89153 Nov 22 05:16 BCCDC_COVID19_Dashboard_Lab_Information.csv nicholas@mordor:~/csv$ nicholas@mordor:~/csv$ pwsh PowerShell 7.1.0 Copyright (c) Microsoft Corporation. https://aka.ms/powershell Type 'help' to get help.

How to export XML from a SQLite query to a file with PowerShell?

旧巷老猫 提交于 2020-12-15 03:36:02
问题 Using Linux , getting started with SQLite , PowerShell and xml , and so this question is in that context. How do I nicely export the results below? PS /home/nicholas> PS /home/nicholas> $Database /home/nicholas/sql/covid.db PS /home/nicholas> PS /home/nicholas> $Query select * from labs limit 3 PS /home/nicholas> PS /home/nicholas> Invoke-SqliteQuery -DataSource $Database -Query $Query Date : 1/23/2020 12:00:00 AM Region : BC New_Tests : 2 Total_Tests : 2 Positivity : 0 Turn_Around : 32 Date

Update the Azure Release Variable value in PowerShell

那年仲夏 提交于 2020-12-15 03:33:53
问题 I have Release Variable $(ecomm) = Yes, in Azure Release Pipeline Through Powershell, i want to update the value of $(ecomm) = No Write-Host "Before update: "$(ecomm) Write-Host "##vso[task.setvariable variable=ecomm;]No" Write-Host "After update: "$(ecomm) But the value is not updating. Can you please help me on this. Thanks in advance. 回答1: Repcak is correct. When you use the logging command to set variables in Powershell, you can only change the value of the variable in Pipeline Run

Update the Azure Release Variable value in PowerShell

爷,独闯天下 提交于 2020-12-15 03:32:38
问题 I have Release Variable $(ecomm) = Yes, in Azure Release Pipeline Through Powershell, i want to update the value of $(ecomm) = No Write-Host "Before update: "$(ecomm) Write-Host "##vso[task.setvariable variable=ecomm;]No" Write-Host "After update: "$(ecomm) But the value is not updating. Can you please help me on this. Thanks in advance. 回答1: Repcak is correct. When you use the logging command to set variables in Powershell, you can only change the value of the variable in Pipeline Run