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.

powershell
0 votes
1 answer
16 views

How to prevent the message "File open in another application" when creating excel instance

I was running a PowerShell script perfectly fine earlier, but for some reason this message popped up that's saying the file is open in another application. I have checked task manager and the excel ...
t0mas's user avatar
  • 1
0 votes
0 answers
13 views

PS: Redirecting error output of assignment statement to a variable

I am calling PnP-GetWeb like this: [Microsoft.SharePoint.Client.SecurableObject]$Web = Get-PnPWeb -Connection $pnpConnection -ErrorAction SilentlyContinue if($null -eq $web) { throw &...
Craig's user avatar
  • 637
0 votes
0 answers
6 views

Is it possible to run Connect-IPPSSession, Connect-ExchangeOnline using pwsh on a linux server?

I am trying to use the Powershell ExchangeOnlineManagement module, but I have to perform some automations on a Linux RedHat server and I would like to know if it is possible to execute commands like ...
José's user avatar
  • 1
1 vote
1 answer
17 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,121
-2 votes
2 answers
36 views

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

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
29 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
20 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
1 vote
2 answers
49 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
1 vote
2 answers
36 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
2 answers
51 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
35 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
50 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
32 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

15 30 50 per page
1
2 3 4 5
7873