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
118,120
questions
-1
votes
0
answers
22
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 ...
2
votes
1
answer
32
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 ...
0
votes
1
answer
50
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 &...
1
vote
3
answers
47
views
Powershell: add new line after every line that contains a given string
I have a >7000 line XML file, which I define as $File, and which contains (scattered throughout all the other lines) four lines exactly as follows:
<text:p text:style-name="P27">&...
-3
votes
0
answers
60
views
Cannot Download latest version of Chrome driver v126 or most latest via powershell command [closed]
Please correct my script if necessary: and please understand that I am new on this.
Script
# Define the destination folder
$destinationFolder = "C:\Users\123\Downloads"
# Create the ...
0
votes
1
answer
40
views
PowerShell: get data from a System.Collections.Generic.list [closed]
I'm struggling to get data from a generic list object in powershell.
This is the output of my list object and I am trying to get the name value.
{@{[email protected]; id=3; loginName=i:0#.f|...
0
votes
2
answers
29
views
Start a process in Jenkins without waiting for its end
I'm able to start a process in my Jenkins pipeline easily, but I'm struggling to avoid being blocked by the process.
Currently, Jenkins is waiting for its end before going on to the next step, but I ...
0
votes
0
answers
40
views
How to launch an application in the second desktop using PowerShell cmdlet
I need to run a PowerShell script using PowerShell or some other means in another desktop without switching back and forth across desktops. I could not find any cmdlet or other way to accomplish this. ...
0
votes
0
answers
18
views
How to add a reg file into Intune App Packager using Powershell?
Can anyone advise me on how I can add the below REG file to an MSI I wish to package on Intune using IntuneWinAppUtil? I understand that Powershell could be utilised, but I have never used it before ...
0
votes
0
answers
14
views
Changing User Rights Assingments From A Powershell Script [duplicate]
I am currently working on a project to make a script to get any computer CIS compliant up to IG3 level. Part of this includes changing the User Rights Assignments to only Admins or remote desktop ...
0
votes
1
answer
52
views
Azure DevOps AWS CLI with Powershell
I have a AWSShellScript task that executed a powershell script - example below trimmed for this post.
-task: AWSShellScript@1
inputs:
scriptType: inline
inlineScript: 'pwsh -File test-script....
0
votes
1
answer
25
views
Power Shell script to automate need to install modules
Load required assemblies
Add-Type -AssemblyName System.Windows.Forms
Add-Type -AssemblyName System.Drawing
function Show-MessageBox {
param (
[string]$message,
[string]$title
)
[System....
-1
votes
0
answers
18
views
Automatically upload OneDrive files on log off/reboot
I am trying to set up automatic uploading of downloaded files to a user's OneDrive directory, at logout. When running my script at logout the OneDrive processes are already completed, I edit the ...
1
vote
1
answer
39
views
Prevent system shutdown while task scheduler task is running
How can I create a task in Windows task scheduler that prevents (automatic) system reboots while it is running? I want the task to finish before any restarts are performed.
Note: I'm aware that one ...
0
votes
1
answer
45
views
Powershell: replace every line that contains a given string
Suppose I have a text file that contains the following lines:
Apple
Bananas
Fruit things
Oranges
Fruit pieces
I want to replace every line that contains the string "Fruit" with a new line ...