I have a file named output.txt that contains the following data: device:VM01,partition:"C",size_gb:100 device:VM02,partition:"D",size_gb:200 device:VM03,partition:"E",size_gb:150 When I read each line and use ConvertTo-Json, I expect the result to be: [ { ...
Looking for Help [ { "example": "abc123", "exampleName": "abcd_test", "exampleShortcode": "", "isComplete": false }, { "example": "def456", ...
I am currently working on a Vue project using Vite in Windows 11. Whenever I try to run "npm run dev" with PowerShell (which is vite --open --host), I encounter the following error:https://i.stack.imgur.com/LPSc0.png It seems like the path is showing as & ...
Is there a way to output all the contents of a nested JSON hash table in PowerShell in a single line? $json = @" { "outer": "value1", "outerArray": [ "value2", "value3" ], "outerHash": { "inner": "value4", " ...
When working with full-stack development in VS Code, it's common to accidentally leave the server running without stopping the batch process. This can lead to issues like encountering the error message Port XXXX is already in use when trying to run up ...
Is it possible to generate a JSON output with an array of objects sorted in ascending order based on the "count" property? I need to maintain the original $result object structure, without caring about the order of "Good" or "Bad", My goal is to sort the o ...
Struggling to make my code work despite looking at numerous examples. The JSON structure appears unique and I need to extract "id" and "legalName" from the results. [ "URL: https://myurl.com/rest/api", { "value": [ ...
My Selenium tests navigate to a specified URL using the code: driver.Navigate().GoToUrl("www.blahwhatever.com"); Currently, I am able to execute these Selenium tests using either a batch file or PowerShell script. Ideally, these scripts would be triggered ...
I searched extensively online but was unable to determine the root cause of the error. I attempted adjusting the path variable as a potential solution. Could someone please provide guidance on how to resolve this issue: To install yo, I used the command: ...
Is there a way to automatically check for the availability of a new stable version of NPM online without manually opening a browser? If a newer version is found and it's greater than what I currently have installed globally, then I want to run the command ...
Having trouble running a batch file on a remote server to execute an automated Selenium test On a remote server, there is a batch file named mybatch.bat that triggers a Selenium test. Below is the code snippet in a Powershell script on the same server: $ ...
While working on a PowerShell script to upgrade my webdrivers before running a selenium script, I encountered an issue. The command I was using to retrieve the version of msedgedriver.exe was successful, but when I tried the same command for chromedriver.e ...
Recently, I started diving into Angular and encountered an issue using PowerShell in Windows. Every time I run an angular command like: ng new new-app or ng serve I keep getting this error message: ng : File C:\Users\< username >\ ...
$Settings = (Get-Content -Raw -Path $settingsFile)| ConvertFrom-Json -Verbose Output: @{key1=value1; key2=value2} From the input file: { "key1": "value1", "key2": "value2" } I seem to be receiving a string instead of the expected result. What c ...
I am working on a project to extract rows from a large JSON document and insert them into an SQL Server database. The current code I have successfully inserts one row at a time into the table, which seems to be every 1000th row. add-type -path "C:\P ...
Attempting to shrink a large 700MB JSON file, which is a scaled-down version of the file found here: The goal is to eliminate unnecessary data by excluding certain keys such as hypernyms, pos, categories, and more. However, previous attempts at this using ...
Is there a way to execute a Python script in Notepad++ that launches in Windows Powershell and runs the script directly from its directory, even if the directory path contains spaces? ...
There's a json file named mytest.json, and I am looking to modify its values using a PowerShell script. The update.json file looks like this: { "update": [ { "Name": "test1", "Version": "2.1" }, ...
Running some simple files using React in Powershell and trying to stop the script. When attempting Ctrl+c, it only displays stopping endlessly. Ultimately, I find myself having to close out of Powershell and utilize task manager to end the npm scripts. Ev ...
I need help with converting a JSON file into a CSV file while avoiding duplicate values in the output. I want to include four columns in my CSV file without repeating any data. My approach involves storing variables in an array and writing them to a CSV f ...
Check out this brief PowerShell code snippet: $users = New-Object System.Collections.ArrayList $userAsJson = ' { "name" : "abc", "companies" : ["facebook", "google"] }' $user = $userAsJson | ConvertFrom-Json $null = $users.Add($user) $users | Conv ...
After researching various sources, it seems that the subprocess library in Python is commonly used to run PowerShell commands from within Python. For instance: data = subprocess.check_output(["powershell.exe", "Connect-AzureAD -AccountId < ...
I am facing an issue with sending emails using a PowerShell script as my company's Virus scan (McAfee) is blocking port 25. While I am aware of the option to disable the "prevent mass email" setting in McAfee and calling Outlook within the script, both opt ...
Here is the code snippet I've been working on using PowerShell: $ArrayOfArguments = @("Param1", "Param2", "Param3") $ArrayOfArgumentDescriptions = @("Description1", "Description2", "Description3") ...
I've been attempting to duplicate the condition block from id 106 to id 107 using the script below, but I keep encountering an error stating "ConvertFrom-Json: Invalid JSON primitive:". Is there something important that I am overlooking? Any guidance would ...
In the root directory of my site, I have made changes to the package.json file by adding the "scripts" hook below: "scripts": { "ngDeployDev": "@powershell -NoProfile -ExecutionPolicy Unrestricted -Command ../../Scripts/ng-build-deploy/ngDeployDev.p ...
Is there a way to retrieve the Description section of a font's properties, as seen when you right-click on the file? https://i.stack.imgur.com/rwnLw.png I am specifically looking for details related to the Title attribute. I tried using the get-file-pro ...
As a newcomer to both PowerShell and HTML, I am venturing into the realm of extracting table data from a webpage using the powerful combination of PowerShell and Selenium webdriver. My approach involves automating the process of launching a specific webpag ...
I am attempting to run a PowerShell script that utilizes Selenium and Start-Job Start-Job { $Url = 'https://stackoverflow.com/' $Driver = Start-SeChrome Enter-SeUrl -Url $Url -Driver $Driver } The intended functionality is for the script ...
Currently, I am using Windows Powershell and a pipeline to create the package for an application deployment. Here is the pipeline setup: https://i.stack.imgur.com/am2iR.png My current obstacle revolves around the "npm install" command, as I want to avoid ...
I'm facing an issue while attempting to execute the following commands: npm install -g @sanity/cli >> sanity init --coupon javascriptmastery2022 and this error message is displayed: sanity : File C:\Users\...\AppData\Roaming ...
Recently, I've been working with a JSON file that looks like this: { "buildDate": "2017-08-16", "version": "v1.2.0" } I've been wondering about how to add new key-value pairs to an existing JSON file. For instance, starting with the J ...
I have a scenario where I am importing JSON data into Powershell to update certain values, but I also need to remove specific objects from the imported data. Here is my import code: $fileJson = Get-Content -path/Template.json -Encoding UTF8 In the JSON ...
Does anyone know of a straightforward method to merge one JSON file with another and save the combined output to a new file using PowerShell? I am currently working on creating a recursive function for this purpose, but I'm wondering if there is a sim ...
My Windows PC does not grant me admin rights, but the admin has already installed Node at C:\Program Files\nodejs, with version 12: PS C:\Users\JO52900> node -v v12.18.3 PS C:\Users\JO52900> Get-Command node CommandType ...
Currently, I am in the process of creating a Powershell script to expedite setting up my development environment. My goal is to have multiple instances of WSL programs running on bash terminals. My objectives from within Powershell are as follows: Open a ...
Brand new to ".sh" right now when faced with this question. I am not even certain what ".sh" refers to - Shell, Powershell, Bourne shell, etc. Currently, I am operating from a Windows OS. The goal of this question is: Change directories Run the npm scrip ...
When attempting to add an assembly from a network UNC share using the following command: $scriptPath = Split-Path ($MyInvocation.MyCommand.Path) Add-Type -path "$scriptPathselenium-dotnet et40WebDriver.dll" You may encounter the following error: Add- ...
I have multiple databases from various SQL Servers. I am attempting to output SQL data to an HTML table using Powershell from these different databases/SQL Servers, and then send it via email. Although my current script is functioning, it generates multip ...
After pulling a list of IPs from a JSON file, I've been using the code snippet below: $Request = 'https://url-to-json.com/file.json' $AWSIPs = Invoke-WebRequest $Request | ConvertFrom-Json | Select-Object prefix -ExpandProperty prefixes -ExcludeProperty ( ...
At the moment, I am focused on retrieving the expiry status of Azure AD applications. I have collected approximately 1700 AD applications and added a new key pair (status) to the JSON object based on the expiration date of the secret. 1) valid 2) Expired 3 ...
Whenever I work on my projects locally, I usually run MongoDB and start Nodemon. To do this, I open up terminals in vscode but I often forget the specific commands needed for each. As a result, I have to refer back to a txt file where I copy and paste the ...
While setting up a new project with Firebase, I encountered an issue after running the firebase init functions command. The error message displayed is as follows: firebase : File C:\Users\fudge\AppData\Roaming\npm\firebase.ps ...
I am currently facing an issue with the script in our package.json that is meant to run single test files using a specific syntax. The problem arises when running this script in Windows 10 with Powershell, as it generates an error message: "singleTest ...
I need to retrieve drive information from a collection of Windows servers running between 2008 and 2016 using PowerShell. I have successfully written code to fetch the information locally, but I am struggling to do it remotely or from a text file containin ...
I'm currently facing a challenge that I am struggling to overcome due to my lack of experience. Any assistance from the experts on this platform would be immensely helpful :) My task involves converting JSON input into property format. For example: T ...
Currently, I am utilizing Selenium in conjunction with PowerShell to launch a dashboard display using Internet Explorer on a large office monitor. The process is initiated as follows: $seleniumOptions = New-Object OpenQA.Selenium.IE.InternetExplorerOption ...
When creating a local NPM project designed to act as an installable NPM CLI command on Windows, I encountered issues with local testing not behaving as expected. To showcase this problem, I have set up this GitHub repository. Take a look at the provided r ...
I'm currently developing a PHP web application on an IIS web server, and my goal is to create a read-only PowerShell live web console. Here's how the setup works: 1) On the main "console" page, there is a div element along with some buttons. I ...
An error occurred while running the command in the cmd prompt: C:\Users\Admin>cordova C:\Users\Admin\AppData\Roaming\npm\node_modules\cordova\node_modules\execa\index.js:347 th ...
I am attempting to connect to a Windows machine using SSH and run a command in the background. When I directly run the following command from the terminal after establishing an SSH connection, it works: start PowerShell.exe -ExecutionPolicy Unrestricted I ...
While attempting to retrieve the session ID, I encountered an issue where the output displayed the column name instead of the actual ID. When using a match function, the correct value is returned since the output does not include the column names. Is ther ...
I am currently working on writing a PowerShell script to interact with Shopify's API and retrieve JSON data. I have set up a private app, and successfully accessed a JSON feed via a browser. Initially, I managed to make it work using System.Net.WebClient, ...
In a recent blog post by the PowerShell Team, they discussed the use of posh commands. Can we utilize Create() without loading any PS command to function as a system process executor (similar to System.Diagnostics.Process)? How can we achieve this wi ...
The JSON file is located at %Workspace%\solution\config\appsettings.json { "appName": "Test", "appId": "1", "env" : "Test", "url" : "https://url.com", "client_id": "", "client_secret": "", "QAEmail" : "<a href="/cdn-cgi/l/email-protecti ...
Currently, I am facing an issue while attempting to globally install a package that requires installation from an administrative cmd/powershell (as it utilizes windows-build-tools). The installation process goes smoothly without any errors when executed th ...