Skip to main content
The 2024 Developer Survey results are live! See the results

Questions tagged [powershell]

PowerShell is a cross-platform command line and scripting utility from Microsoft. Use this tag for questions about writing and executing PowerShell scripts ONLY. Programming questions specific to the cross-platform version PowerShell Core (Windows, macOS, and Linux) should be tagged [powershell-core]. Questions about system administration should be asked on Super User or Server Fault.

0 votes
1 answer
13 views

Yarn PM not working in Windows when the User folder(UserProfile env var) has space in folder name or path

As stated in title, the Yarn PM(package manager), that I just installed in my system(Windows 11 64Bit) doesn't work if there's space(s) in my UserProfile folder path. My User folder name is "...
Vicky Dev's user avatar
  • 2,109
-2 votes
2 answers
31 views

Is there a way to checkout latest version of origin branch without warnings

I wrote a powershell script to obtain git submodule and set his branch. It will run from pipeline and branch name will be passed from launch form input. Param( [Parameter(Mandatory=$false)] [...
Intolighter's user avatar
0 votes
0 answers
28 views

az cosmosdb update --ip-range-filter parameter either from file or powershell pipe

The az cosmosdb update command that I am using has exceeded length of 8192 characters so I am receiving "The command line is too long." error, the command itself looks following: az cosmosdb ...
sjanisz's user avatar
  • 97
0 votes
1 answer
16 views

Failed to update help in windows powershell

I am an absolute beginner to Command Line Interface and noticed this when trying to update the help (I'm following Learn Enough Command Line to Be Dangerous, which I suppose is for Linux and I am ...
Gungun Tyagi's user avatar
0 votes
1 answer
37 views

Place every item from a text file into an array but detect headers/titles

I have text files that contain Firstname: xxx Lastname: yyy Login: abcd It has many others entries for other definitions but all in the same format header: data I would like to use an array in ...
Billy Smith's user avatar
0 votes
1 answer
22 views

Powershell : Cannot convert the "java" value of type "System.String" to type "System.Management.Automation.ScriptBlock"

I have a powershell script which converts the String and String[] into a BlockScript. It was working until now but it starts to fail suddenly after some windows upgrade. function Invoke-...
Abhishek-M's user avatar
0 votes
1 answer
41 views

How to make PowerShell `Select-String` aka `sls` output exact match(es) only?

In a PowerShell script, I would like to check if a branch exists locally already, which I'm currently doing as $existsInLocal = (git branch | sls $branch) -ne $null, but that's incorrect because sls $...
joseville's user avatar
  • 841
0 votes
0 answers
34 views

ps1 file wont run unless I change the encoding or add any character into the script

This is a weird issue, the scripts are coming from Intune deployed from patch my PC. On some devices when i try run these scripts they just hang and eventually timeout. If i convert the file to UTF-8-...
Owain Esau's user avatar
  • 1,892
0 votes
1 answer
45 views

PowerShell StandardOutput Redirect Issue

I am trying to use ghostscript to get the number of pages in a PDF. I am getting this error: Select-Object : Exception getting "StandardOutput": "StandardOut has not been redirected or ...
Peter Sun's user avatar
  • 1,727
-1 votes
1 answer
28 views

How do I write a powershell function to send a warning if files don't exist?

I am new to powershell scripting and I am trying to create a function that sends a warning to my email if a list of files do not exist in my C: drive folder. The list of files I am looking for are: ...
Forgottenluv's user avatar
0 votes
0 answers
10 views

401 (Unauthorized) Request Id when calling Get-DataGatewayCluster with a service principal

Currently trying to use a service principal in order to check power BI connection status Connect-DataGatewayServiceAccount -ApplicationId $xx -ClientSecret $xx -Tenant "xx" $scopeLevel = &...
learner's user avatar
  • 835
0 votes
1 answer
40 views

Powershell - format info to csv

Trying to query non-windows native program (dell racadm) info and format string into csv file with other info. Everything works until I get to the iDracIP and it returns blank in the csv file. I ...
Von's user avatar
  • 1
-1 votes
0 answers
20 views

How to pass docker commands through Powershell

Everyday i have to restart docker containers everyday. Don't ask. So i want to make Powershell script that connects through SSH to server with docker and then restarts all containers. So right now my ...
Nexen's user avatar
  • 1
2 votes
1 answer
31 views

Winget ls shortening ids

I'm not sure if this is a winget question or a PowerShell question. Basically, winget ls output is too wide for the shell window, so it cuts off the column with ellipses. I tried ooutputing to a file ...
Nicolás Fernández Fioretti's user avatar
0 votes
1 answer
48 views

Powershell if function calling another function

I have 2 functions when I call the second function from the first one, always returns true doesn't matter if the second function has false return: function IsPodRunning($podName) { Write-Output &...
Alberto Serrano's user avatar

15 30 50 per page