Questions tagged [powershell]
Tag to be used for questions about Microsoft Powershell. For general shell questions, use the [shell] tag. For other shells, use their own tags like [bash] and [zsh]. For questions about scripting, the tag [scripting] should be used along with the shell tag.
45 questions
-2
votes
1
answer
295
views
How do I install Microsoft Powershell on CachyOS Linux?
The official docs doesn't have a section for CachyOS or Arch Linux.
I tried following some guides online to build it myself, to install AUR, snap, pacman, and I don't know what other methods, but none ...
0
votes
2
answers
217
views
Can I run Powershell on Linux in something like "5.1 mode"?
I'd like to develop some short scripts for Windows users, but my computer is running Debian 12. I'm aware that I can tell the Windows users to install Powershell 7 or another scripting language which ...
0
votes
0
answers
127
views
Trying to SSH into Ubuntu VPS from powershell, keep recieving public key error
I read through some other threads of similar issues but none of the solutions worked (haven't tried overwriting the public key as I don't know if that will lock me out or cause other issues, if this ...
0
votes
3
answers
3k
views
SSH permission denied via Windows PowerShell
I want to log into a Ubuntu server from my Windows machine. When I use PowerShell, permission is denied.
PS C:\Users\sebastian> ssh [email protected]
[email protected]'s password:
Permission ...
0
votes
1
answer
120
views
Forcing Server Reboots if not rebooted within X days of patching (Azure Hosted)
I host numerous RHEL 8 servers in the Azure environment. I am using a Red Hat Satellite VM to patch servers and then I rely on the owners to reboot once patching is complete. I want to implement a ...
0
votes
1
answer
162
views
Ubuntu/Orange Pi5 retrieve open tabs on Chromium (kiosk mode) via terminal - Powershell
I have a problem as of late where I am developing some PowerShell script to manage and update some digital displays. Please see below for my work in progress (By no means done).
I am struggling to be ...
0
votes
1
answer
306
views
How can I SSH to a PowerShell on Windows and keep a set of working arrow keys?
I can do this to directly enter a PowerShell
ssh foobar 'powershell'
, but in this shell, arrow keys won't work.
It works if I just:
ssh foobar
..and then enter PowerShell, by typing powershell. ...
0
votes
1
answer
99
views
I try to copy a file from a GCP instance to my local machine, but powershell gives me a "Permission denied: (publickey)"
I created a GCP instance, and I created a private and public key on kali linux, I saved this key in the metadata of GCP, so I can access the instance through my kali machine. Then, I need to copy a ...
2
votes
2
answers
6k
views
yt-dlp + mpv chained media playback
I've been using yt-dlp to download audio files before running mpv for playing them back.
I've been specifically using the following commands:
yt-dlp -f ba "ytsearch:major artist cool music"
...
0
votes
1
answer
1k
views
How to use evince to open PDF accessed through remote ssh?
It is extremely likely this question comes from a major misunderstanding, but I will explain what I am trying to do/have done. I am also not fully sure this is a Linux/Unix issue.
My goal is to view a ...
3
votes
1
answer
506
views
How do I enable colours by default for common utilites in PowerShell on (Gentoo) Linux?
I'm currently running Gentoo Linux and have installed PowerShell (app-shells/pwsh-bin) as I am a contrarian.
That being said, I am unable to obtain colour by default when running certain commands. ...
2
votes
2
answers
450
views
Do executable shebang scripts always require LF line endings?
On Stack Overflow a comment to Can PowerShell Core handle ps1 files with CRLF line endings in Linux environments? asserted that executable files that use a shebang must use only the LF line ending, ...
0
votes
1
answer
667
views
Get return value from kubectl exec out into powershell script [closed]
So I'm working on a powershell script that runs a pester test. The script connects to a Kubernetes pod with a Mongo database. The goal is to check whether or not a collection in the database is empty. ...
0
votes
1
answer
215
views
How do I change the name in multiple files in the middle one time?
For example I have 190 files and I want to add L001 in the middle. How can I do that using cmd command, or PowerShell if it is better? Also some numbers are 2 digits some are 1.
PP-SD01_S1_R1.fastq.gz
...
0
votes
1
answer
4k
views
`find` command doesn't return array like element, how to work around this
In powershell I'm used to doing something like this:
> $python_files = get-childitem *.py
> echo $python_files[0]
The second command allows me to extract the first file, since get-childitem ...
1
vote
1
answer
4k
views
Powershell to get monitor DPI scaling of ALL monitor
Using the DPI class script referenced here I can get DPI scaling for my main monitor how would I also get the output from any additional monitors which may have a separate scaling factor?
0
votes
2
answers
949
views
Echo choices to Choice Menu to run program directly from CommandLine
When I run a specific program with choices
Do this
Do that
Do something else
And eventual sub-choices
Enter website:
Enter credentials:
I want to do the following
echo {choice} | echo {choice2} | ...
-1
votes
1
answer
1k
views
Use conditional formatting in jq - PowerShell [closed]
This is a follow up question from this question that got contributed by another person. I have following output from a webserver:
{
"status":"OK",
"result":{
...
0
votes
0
answers
148
views
Are there any Live CDs (ISOs) that come with Powershell?
It seems to me that the license surrounding Powershell would prevent a Live CD coming with Powershell; but I'm not a laywer.
But it also seems to me that it would be somewhat useful for purposes of ...
0
votes
1
answer
153
views
WSL script fails when launched by a Windows shortcut
I have a small script that checks if my rsync backup has completed and if so sleeps my machine.
This is on WSL (Debian).
#!/bin/bash
# if rsync is running, then wait 5
while ps aux | grep -q -e "...
0
votes
0
answers
165
views
Some update is causing shell scripts to fail which works fine when ran directly from powershell
The call
instaloader --post-filter="likes > 16720 and not is_video and date_utc >= datetime(2021, 5,
29)" --no-profile-pic --no-videos --count=12 cristiano
works fine.
But put the ...
-1
votes
1
answer
294
views
How to run a PowerShell file during boot as root on Asterisk?
On Asterisk boot/reboot I want a PowerShell file to be executed.
I have created a .ps1 file on /var/spool/ which is supposed to copy new files from an asterisk directory and transfer them to an Azure ...
0
votes
1
answer
425
views
How to filter multiline with awk, grep and/or powershell
My scenario is I have a file that has the contents looking like this but longer. https://pastebin.com/q33wFdAX
I need to remove each occurrence of
<category>Games</category>
</...
-4
votes
2
answers
382
views
Print a webpage in PDF format
I have a requirements where I need to print a webpage in PDF format.
Created one dashboard and shared it using permalink(a permanent static hyperlink to a particular web page).
I need to print this ...
3
votes
0
answers
249
views
Opening powershell remote sessions in a loop in linux leaks memory
I am stuck with the following problem: we have an app that runs an continuous loop opening remote connection via powershell (performing some actions and then closing). This works fine in a Windows ...
4
votes
3
answers
5k
views
Would it be best for PowerShell scripts to also have a shebang?
Shell scripts are better when having a shebang like so:
#!/bin/bash
echo "The shebang above this line works like a typical a comment but with a purpose"
PowerShell scripts are also shell ...
1
vote
0
answers
260
views
Powershell (pwsh) user bug?
I'm on Fedora 33 + Gnome.
Open gnome-terminal in a folder (let's say, the Downloads), open another terminal tab/window and type pwsh: if you check the value of $profile it refers to a temporary ...
0
votes
1
answer
1k
views
Syntax highlighting uses "invisible" colors when using VIM in SSH from Windows 10
I have gone very old school but it's is great fun. vim is great at editing without GUI so connecting to a remote data collecting PI it gives a very simple stack to maintain code and settings.
It works ...
0
votes
2
answers
585
views
Can I update a ext4 filesystem's file create timestamp from Windows Powershell over a network share?
I have a script I run from Windows Powershell and it can update a files modified, and last accessed timestamps. I run the script from a Windows 7 laptop but it can update file timestamps that reside ...
1
vote
1
answer
2k
views
Inserting into a Oracle table from a shell variable storing thousands of values
I'm trying to insert records into a column in Oracle where the values are passed from a shell variable. The variable itself stores pattern generated from a list of files. This pattern is generated on ...
1
vote
0
answers
1k
views
installing WSL Ubuntu: Add-AppxPackage fails, "The Visual Elements extension failed while processing the Notification element"
I want to install WSL 1 in my Win 10 OS, and have followed the instructions at https://docs.microsoft.com/en-us/windows/wsl/install-win10
from PowerShell as Admin: dism.exe ... - no problem
...
1
vote
1
answer
2k
views
Unable to connect to a Linux port from Windows
I'm trying to run a gRPC service on Linux while running a client on Windows.
I seem to be unable to test the Linux port that I use from my Windows machine.
Both machines are in the same network.
...
1
vote
1
answer
31
views
VMWARE create a Vm [closed]
I want create one template template from one modele with power cli.
I have esxi 6.5 and vcsa 6.7
Plese can you help me
1
vote
0
answers
1k
views
using powershell on Linux with Ansible
In looking at powershell, the general assumption is that it's being used either for or on Windows machines in a homogeneous network.
Strictly within Linux, and only using "core" powershell, looking ...
0
votes
1
answer
1k
views
Need to convert a ssh output to json format
I have a piece of code which generates a output as chunk.
TIBCO ActiveMatrix BusinessWorks version 6.4.2, hotfix 7, build V103, 2018-07-18 Connecting to the BW Agent using TIBCO ActiveSpaces (Java). ...
1
vote
1
answer
2k
views
How to get info on disk drives with powershell
Is it not possible to install Get-Disk on Linux?
PS /home/thufir/powershell>
PS /home/thufir/powershell> Get-Module -ListAvailable
Directory: /home/thufir/.local/share/powershell/Modules
...
1
vote
0
answers
521
views
Can PowerShell be run on TinyCore Linux?
Is there a way to install PowerShell on TinyCore? The below link is the MS documentation for supported Linux distros.
https://docs.microsoft.com/en-us/powershell/scripting/install/installing-...
8
votes
2
answers
2k
views
Installing PowerShell on 32-bit Kali OS fails
I am having some issues installing PowerShell on my 32-bit Kali Linux PC.
I followed this guide and started with:
apt update && apt -y install curl gnupg apt-transport-https
Next, I ...
0
votes
2
answers
1k
views
WSL: Keeping ssh private key accessible as long as I don't restart Windows 10 (like the behaviour of pageant)
So far on Windows 10 I used mainly the PuTTy bundle (PuTTygen, Pageant and PuTTy, etc) to SSH into remote Linux machines.
I use Pageant as a private key holder to hold to private key (and possible ...
1
vote
1
answer
74
views
show volume informations in tabular view
I'm trying to save on linux powershell core 6.1 information about the volumes in a variable. Best in the same or similar format as it is possible on windows.
But i am unable to achiev this kind of ...
2
votes
1
answer
1k
views
Is there an equivalent to PowerShell's "Switch" in bash?
I was curious as to whether or not there is an equivalent to PowerShell's "Switch" command that lets you maneuver with input instead of using a multitude of "if-statements"
8
votes
3
answers
8k
views
Resolve-DnsName : The term 'Resolve-DnsName' is not recognized as the name of a cmdlet
Why is Resolve-DnsName not recognized for PowerShell Core? So far as I recall it works fine with PowerShell itself.
Is this a .NET versus dotnet problem? That dotnet simply doesn't have this ...
12
votes
1
answer
16k
views
wget not saving file after download
So I am currently using the wget command on windows 10 powershell to download various files. However, when testing this command, files do not actually download.
For example, say I want to download an ...
2
votes
2
answers
3k
views
`powershell -version` doesn't work on Linux
I have just installed the open-source version of PowerShell for Linux on Arch Linux using the powershell-git package from AUR. When I try PowerShell's -Version functionality, I get the following:
PS /...
25
votes
8
answers
15k
views
Unix equivalent of PowerShell?
I've always found it awkward when complex shell commands involve parsing text output with AWK. Basically we're converting structured data into text, then parsing the text again to get back at the ...