How to avoid nulling array in JSON with PoweShell
I working with JSON file: { "Job": "abc", "Tasks": [ { "Task": 1 }, { "Task": 2 } ] } and in some cases I have to remove all tasks and then my output JSON file looks like this: {…
I working with JSON file: { "Job": "abc", "Tasks": [ { "Task": 1 }, { "Task": 2 } ] } and in some cases I have to remove all tasks and then my output JSON file looks like this: {…
I wrote the following in my powershell function app: param($Timer) $currentUTCtime = (Get-Date).ToUniversalTime() if ($Timer.IsPastDue) { Write-Host "PowerShell timer is running late!" } # Write an information log with the current time. Write-Host "PowerShell timer trigger function ran! TIME: $currentUTCtime"…
I have the below powershell code to send a message to Azure Service Bus Queue. param ( [Parameter(Mandatory = $true)][string] $ResourceGroupName, [Parameter(Mandatory = $true)][string] $NamespaceName, [Parameter(Mandatory = $true)][string] $QueueName, [Parameter(Mandatory = $false)][string] $PolicyName = 'SASPolicy' ) $test_msg = [PSCustomObject] @{…
I have a python script that I built over the last 2 weeks using python3.10. The script did run fine 100s of times until I reinstalled python/modules. I recently upgraded to Python 3.12. I had to pip install all of…
I need a PowerShell script to get latest binary version from this archive list https://download.docker.com/win/static/stable/x86_64/ So as when I run the script, it checks for latest zip and returns me latest version number and link to download. For example, if…
Html portion $html = @($htm) $html = @" <!doctype html> <html lang="en"> <head> <body> text $computername $username text </body> </html> "@ $html | out-file c:scriptstempReport.html I have html language in the $html variable. When I decide to change the HTML…
I'm trying to use conda, python with VS Code. Everything works well in windows terminal, but after I relaunch vscode terminal, every conda commands doesn't work on vscode terminal (except activate and deactivate). conda command works at first activation Fist…
I am using this command in PowerShell to list all buckets in my account: aws s3 ls --profile xxx-dev I need to list only the buckets that starts with some string. I tried this: aws s3 ls --query "Buckets[?starts_with(Name, 'aveva-erm-')…
I just installed the Microsoft.Graph Module on a fresh Windows 11 installation. Connecting with Connect-MgGraph works fine but if i use any other command after successfully authenticating I get the following error. I have found nothing about this error, but…
I have a existing .json file in GitHub similar to below. { "quiz": { "sport": { "q1": { "question": "Which one is correct team name in NBA?", "options": [ "New York Bulls", "Los Angeles Kings", "Golden State Warriros", "Huston Rocket"…