powershell

Upload/Publish WebApp Files to Azure via PowerShell

坚强是说给别人听的谎言 提交于 2021-01-28 06:45:06
问题 Hi I am currently having a problem updating an old PowerShell script used for Azure. It was originally written to deploy a website after asking a few questions of the user. This was simple enough as you could create a new website via New-AzureWebsite and then Publish-AzureWebsite to upload the files. I am now using New-AzureRmWebApp but can not figure out how to upload the files, there is no Publish command for this and the Set-AzureRmWebApp command does not have a parameter to cover this.

'Rename-Item' makes a copy with the new name

微笑、不失礼 提交于 2021-01-28 06:31:51
问题 Trying to make a script to backup specific folders and then rename the GUID key for the target user under HKLM...\ProfileLists but the rename-item command makes a copy of the key and creates a new key with the appended name though having full access Tried with -force, tried with move-item instead of rename but it gives the exact same results, a new identical key as original but with an appended name if ((Test-Path $FULLPATH)) { Rename-Item $FULLPATH -NewName "$SSID.bak" -Force if ($?) { Write

Get the list of azure web app settings to be swapped using PowerShell

怎甘沉沦 提交于 2021-01-28 06:25:01
问题 When we perform the swap through the azure portal, it gives us the warning & informative messages regarding the settings to be swapped. Just like in below image: My question is, is there any way I can get these messages list (regarding the settings) through PowerShell code? I tried googling it but couldn't find any way. 回答1: The direct solution is to use the Invoke-RestMethod to request the API captured in the Portal. The problem is that this is a non-public AP I, and we don't know if it has

Powershell date type unable to find

六眼飞鱼酱① 提交于 2021-01-28 06:09:22
问题 I am trying to use PowerShell to connect virustotal API, the code is from virustotal website and I got "Unable to find type [System.Security.Cryptography.ProtectedData]." error message. The code as follow function Get-VTApiKey { [CmdletBinding()] Param([String] $vtFileLocation = $(Join-Path $env:APPDATA 'virustotal.bin')) if (Test-Path $vtfileLocation) { $protected = [System.IO.File]::ReadAllBytes($vtfileLocation) $rawKey = [System.Security.Cryptography.ProtectedData]::Unprotect($protected,

Cube refresh with Automation Account in Azure SSAS

坚强是说给别人听的谎言 提交于 2021-01-28 06:05:37
问题 I'm currently trying to create an automation runbook to process a cube in Azure. I've tried multiple PowerShell scripts like this one : $AzureCred = Get-AutomationPSCredential -Name "RefreshTest" Add-AzureRmAccount -Credential $AzureCred | Out-Null Invoke-ProcessASDatabase -databasename "MKTGCube" -server "AzureServerName" -RefreshType "Full" -Credential $AzureCred With that kind of error (despite the fact that I installed the SQLServer module). Invoke-ProcessASDatabase : The term 'Invoke

Nested foreach loop in powershell

瘦欲@ 提交于 2021-01-28 06:01:26
问题 I am trying to read the values from file abc.txt in below function abc.txt a=abcdef123 b=ngh567 c=defh123 Below is the function: function List { Write-Output "Below are the window boxes" $alph = @(get-content -Path "abc.txt" | %{$_.split('=')[0]}) $machinelist = @(get-content -Path "abc.txt" | %{$_.split('=')[1]}) $counter = 0 foreach ($mac in $machinelist) { foreach ($env in $alph ) { { $counter++ write-host ""$counter": Press '"$counter"' to select "$env": $mac" } } } I want the input

TFS write string message to build summary

强颜欢笑 提交于 2021-01-28 06:01:05
问题 I want to write string message to TFS build summary. I have a Powershell task with variable $output = $(Build.SourcesDirectory)\scripts\SCRIPT_NAME.ps1 $output that holds ===== Numb. of files for patch in: Win32 = 2 Win64 = 123 --- Numb. of original files: Win32 = 0 Win64 = 12 ===== that scheme is a whole message, now I just want to display it in a place that picture below points or in any other section as long as it is in "Summary" I took a look on this Stack question but it answers how to

Powershell date type unable to find

爷,独闯天下 提交于 2021-01-28 06:00:23
问题 I am trying to use PowerShell to connect virustotal API, the code is from virustotal website and I got "Unable to find type [System.Security.Cryptography.ProtectedData]." error message. The code as follow function Get-VTApiKey { [CmdletBinding()] Param([String] $vtFileLocation = $(Join-Path $env:APPDATA 'virustotal.bin')) if (Test-Path $vtfileLocation) { $protected = [System.IO.File]::ReadAllBytes($vtfileLocation) $rawKey = [System.Security.Cryptography.ProtectedData]::Unprotect($protected,

Replace a value in a json using powershell

独自空忆成欢 提交于 2021-01-28 05:50:38
问题 I have a json file with the following content - { "IsEnabled": true, "EngineConfiguration": { "PollInterval": "00:00:15", "Components": [{ "Id": "Logs", "FullName": "AWS.EC2.Windows.CloudWatch.CustomLog.CustomLogInputComponent,AWS.EC2.Windows.CloudWatch", "Parameters": { "LogDirectoryPath": "C:\\log\\2018-05-25", "TimestampFormat": "yyyy-MM-dd HH:mm:ss", "Encoding": "UTF-8", "Filter": "", "CultureName": "en-US", "TimeZoneKind": "UTC", "LineCount": "1" } }] } } I want to replace this date

Terraform: command “Powershell.exe” produced invalid JSON: unexpected end of JSON input

≡放荡痞女 提交于 2021-01-28 05:40:21
问题 I am trying to use Terraform's external provider to run a PowerShell script. I am not able to pass parameters to the script from Terraform. I am using the following code to run the script: variable "file_path" { type = "string" description = "Enter the powershell file path" default = "../../Services/azurerm_iam_role/Powershell_Scripts/test.ps1" } data "external" "powershell_test" { program = ["Powershell.exe", "${var.file_path}"] query = { foo = "asdf" bar = "Hardcoded" } } The following is