Questions tagged [powershell]

Windows PowerShell is a command line shell and scripting language for Windows that supersedes the CMD.exe shell and batch language. PowerShell is also an automation engine for Windows that provides functionality similar to Windows Script Host and VBScript.

Filter by
Sorted by
Tagged with
0 votes
0 answers
7 views

How to allow 1 user to a room resource that is managed by a delegate

I have created a Room mailbox = [email protected] Current setup is = Booking delegate settings > Select Deletegates who can accept or decline booking request == [email protected] We have directors that need ...
SSP's user avatar
  • 81
0 votes
0 answers
5 views

Permissions error in directories used by Docker and application I am developing

I have run a docker container mysql from my own application development on C#, and configured data persistence to this path: C:\ProgramData\Persistence\data\mysql When i start everything goes well ...
Francisco Nuñez IA Lover's user avatar
0 votes
2 answers
21 views

While Function - Loop on failure to match input password for new AD user creation script

I am creating a script with basic variables to create users in AD via PS7 rather than remoting in to AD and manually creating. It runs through several questions and then my script will run at the end ...
DeltaSun510's user avatar
0 votes
1 answer
52 views

Displays Specific Text From Website (PowerShell) [closed]

What is PowerShell command to displays Specific text from website? like it displays text from a file.txt with Get-Content Command. For example, from url https://ss64.com/nt/, How to displays Specific ...
Mr.Key7's user avatar
  • 175
0 votes
1 answer
38 views

Getting Two Character Variable Without Pressing Enter (PowerShell/ CMD)

Bash Script #! /bin/bash read -n 2 -p '2 digit:' ans; echo $ans When i finish input two character, the script continue, without waiting me to press enter And what I have pressed saves to the variable ...
Mr.Key7's user avatar
  • 175
0 votes
0 answers
20 views

Why does the DISM command report the error 3 times if its run with all caps?

I'm trying to install a driver manually using its .cab file on windows. But I'm having an issue where dism is saying that it can't find the file even-though its clearly there. DISM /Online /Add-...
Gabriel Fair's user avatar
  • 3,818
0 votes
0 answers
22 views

Automatically reconnect to wireless display after failure

We have a ceiling mounted LS740HD projector back-projecting to a transparent screen pasted to our Information Centre front window. Because of cable length and placement restrictions, the projector ...
Ken Maynard's user avatar
5 votes
1 answer
567 views

Are there commands in PowerShell 7 to split the current window into four and request to run Python files in each of them?

Currently, I click + 3x while holding Alt to create four divided terminals within the same tab: In each of these, I need to run a different Python commnd: cd "C:\Users\Computador\Desktop\Test ...
Digital Farmer's user avatar
0 votes
1 answer
64 views

Gaining administrator privileges from Function PowerShell

1. GetAdmin from function inside Script function test { GetAdmin if ( $(fltmc).count -eq 3) { 'Not Admin' } else { 'Admin' } write-host "`'$PSCommandPath`'" pause; exit ...
Mr.Key7's user avatar
  • 175
0 votes
1 answer
60 views

Moving Multiple Specific Files Up One Directory [closed]

I have a folder structure that's like this: Parent Folder -Folder1 --Sub1 ---files -Folder2 --Sub2 ---files -Folder3 --Sub3 ---files What I'm wanting to do is move files with a specific name (let's ...
Jonathan's user avatar
3 votes
2 answers
233 views

What Equivalent %* of Batch in PowerShell

Batch Script: @echo off if not "!!"=="" setlocal enabledelayedexpansion for /f "tokens=4*" %%a in ( 'dir /AD "%USERPROFILE%\" ^| find "DIR" ^| Find /...
Mr.Key7's user avatar
  • 175
0 votes
1 answer
39 views

Why is start process minimized not working for some applications?

PowerShell code. I tried these and they work properly: Start-Process notepad -WindowStyle Minimized Start-Process cmd -WindowStyle Minimized But these do not work: Start-Process control -WindowStyle ...
Mr.Key7's user avatar
  • 175
0 votes
1 answer
50 views

How to open the CMD or the PowerShell in the Windows terminal when you open them as Admin?

I noticed that when I open the CMD or the PowerShell in non-admin mode, it always opens in the terminal; however, when I open the CMD or the PowerShell as admin, it always opens the old window. Indeed,...
Federico Navarrete's user avatar
0 votes
0 answers
39 views

Simple method to Replace or Add Text of Variable in Powershell

$id = 'c9aaa9c70321' $com = 'adb reboot bootloader' If there is more than one device, $com above not working and getting an error. And command adb in powershell not work too. Must use ./adb So. I ...
Mr.Key7's user avatar
  • 175
-1 votes
3 answers
90 views

PowerShell: Export Ping Results to CSV

I have a PowerShell loop that does effectively what I want it to. The problem is that the output is very messy. I work for an ISP and one of the most effective ways we have to diagnose network issues ...
Chad Dye's user avatar
0 votes
1 answer
62 views

Stop OneDrive in Scheduled Task

I need to stop and resume OneDrive inside a PowerShell Script that runs at Scheduled Task. The stop/resume works fine unless I check 'run whether user is logged on or not'. In that case the OneDrive ...
Max Bündchen's user avatar
0 votes
0 answers
51 views

Can you write a script that contains both bash (or sh) and powershell (or cmd, bat) so the same file can be executed on Win and *nix?

I have a script that needs to run on Windows, Linux and MacOS. I know Windows determines how to run a script by using the file extension, where *nix will use the #!. I'm hoping there is enough syntax ...
David Alsh's user avatar
0 votes
1 answer
52 views

Why is there a save icon and a number next to my git branch in PowerShell oh-my-posh?

I am new to using PowerShell to do my git commands and on some of my repositories, I see the following symbol: what does this symbol mean? I looked up symbols but did not find much.
EveryDayDev's user avatar
1 vote
2 answers
72 views

Start Pwsh/ Powershell Maximized Thought Windows Terminal

Short Description: If pwsh/powershell is not running Maximized, re-open it Maximized I have installed pwsh and wt, with pwsh as the default console in wt, and in some scripts, I want wt to run ...
Mr.Key7's user avatar
  • 175
0 votes
1 answer
88 views

PowerShell, ImageMagick, GhostScript to extract each page of a PDF as a separate image

I'd like to take a PDF and extract each page as an image. I've been able to do this with ImageMagick and GhostScript, but the results are incredibly bad quality. I've tried many different output ...
YorSubs's user avatar
  • 909
0 votes
1 answer
77 views

Calling Function from another function Powershell

function main { $options = @('option1', 'option2', 'option3') CLS; $n = 1 $options | foreach { "[{0}] {1}" -f $n, $_; $n++ } choice /c 123 /m "Choose:" "...
Mr.Key7's user avatar
  • 175
-1 votes
0 answers
94 views

How do I get my terminal to work in VS Code? Exit Code:2, doesn't allow me to type anything

I'm having an issue with the functionality of the VS Code terminal. Whenever I would run a piece of code via the terminal, the terminal would operate for several seconds and disappear. I would then be ...
Jayloneal's user avatar
0 votes
1 answer
30 views

aliasing confusion - what mapped 'vm' to 'Get-VM'?

Intending to launch vim from this PS C:\temp> get-command vim | select name,source Name Source ---- ------ vim.bat C:\Users\noam\AppData\Local\Microsoft\WindowsApps\vim.bat I accidentally ...
noam's user avatar
  • 125
-1 votes
1 answer
46 views

WSL2 is only returning the usage message when I try to install distros

I am following the tutorial here: https://www.youtube.com/watch?v=ZMfHaUkhfc0 I am at about the 15:00 mark. I have installed WSL2 in the Administrator account's PowerShell. I am logged in as a regular ...
MrSnrub's user avatar
  • 97
0 votes
2 answers
61 views

How to Run Powershell commands Sequentially

I have some commands which can only be ran when prefixed with &. They all run asynchronously. Example script: & 'C:\Program Files\SomeApp\SomeAppUninstall.exe'/silent & 'C:\Users\bob\...
Nickotine's user avatar
  • 123
0 votes
1 answer
52 views

How to align spaces in PowerShell code output?

This is my PowerShell code: $Phones = @('iPhone 12', 'Samsung S5', 'Nokia 7') $Manufs = @('US', 'South Korea', 'Finlandia') $n = 0 $Phones | foreach { "$($_) : $($Manufs[$n])" $n++ } ...
Mr.Key7's user avatar
  • 175
0 votes
0 answers
21 views

SSH over Powershell: read user user groups and assign to other user

We try to administrate our Linux-Servers with Powershell-Scripts. I'm working on a script to automatically create user. In my thoughts I extract the groups of a certain user und assign them to the new ...
stalachristian's user avatar
0 votes
1 answer
41 views

CMD/Powershell looking for "curl" executable in the wrong location despite PATH

I have a strange issue with both CMD and Powershell on Windows 10 that has been giving me some trouble. An unrelated scriptwas failing when running curl, and after some investigation it looks like a ...
Syst3ms's user avatar
  • 11
0 votes
1 answer
34 views

Can we get text scaling and monitor properties with WMI?

It is possible to use WMI to detect things like: Text scaling Screen resolutions Multiple Monitor configuration/layout ? I see Win32_DesktopMonitor but it doesn't seem to give me any of this info.
Andrew Truckle's user avatar
0 votes
0 answers
33 views

Powershell script not working to remove first 9 characters of certain files

I have files that I accidentally added dates to. Example 20240325-*. * I tried running this script in powershell and nothing happens: Get-ChildItem -include "20*" | rename-item -newname { [...
Ben H.'s user avatar
  • 17
0 votes
1 answer
41 views

How to list currently installed MS Office apps programmatically?

I want to understand the contents of my Office edition, i.e. which apps (Word, Excel, Outlook) are installed on my machine. For example, I can see this info when I do repair of my Office package, ...
Suncatcher's user avatar
  • 1,325
2 votes
1 answer
43 views

Is there a PowerShell, Batch, or VBS script that can automatically pin the recycle bin to the start menu?

The recycle bin doesn't show up when you type it into the start menu which seems incredibly moronic. I am able to create a shortcut and pin it to the start menu so it shows up, but I'd like to ...
John's user avatar
  • 171
-1 votes
3 answers
53 views

How do I delete files with "- copy" in the name using wildcards?

I have a problem, which appears that How to delete files with specified text in their names? would delete what I don't want deleted. Because of an issue with OneDrive after installing an extra ...
Chris Rogers's user avatar
  • 1,490
0 votes
2 answers
131 views

Powershell: How to unlock bitlocker encrypted drive simple way?

Is it possible to unlock a bitlocker encrypted drive in a simple way? In the command line I would use something like: manage-bde -unlock -pw d: and next type the password. But for powershell the best ...
Ricardo Bohner's user avatar
0 votes
1 answer
32 views

How do I make a command line always show in front of another app

let's say I only have one monitor and I open an IDE and a powershell window. I need to type words in the IDE's current tab while watching the conent of the command line. The problem I have is, ...
user22155685's user avatar
2 votes
2 answers
272 views

PowerShell redirection of Write-Host to file is not working

Can someone explain me that behaviour? What is wrong? PS C:\Scripts\Customer_Shares_Permissions> $PSVersionTable Name Value ---- ----- ...
Chris9834's user avatar
0 votes
4 answers
116 views

How to auto power on windows laptop when lid is opened from shutdown state just like hibernation state?

It has been observed that most laptops power back on by themselves upon reopening the lid if they were in hibernation mode. However, this behavior is not replicated when the laptop was in full shut ...
user3330840's user avatar
0 votes
3 answers
45 views

Powershell $idValue doesn't write the extracted ID, but writes "TRUE" instead -- why?

I am writing a Windows PowerShell script to split a text file based on a delimiter, and create output filenames with an incrementing number and a captured identifier string. I've checked for syntax ...
IanS's user avatar
  • 183
0 votes
0 answers
31 views

Executing Powershell script automatically on domain join

I'm currently working on a customized Windows installation ISO, where local GPOs are predeployed (using LGPO.exe (Local Group Policy Object Utility) and SetupComplete.cmd). This image is targeted ...
Oliver R.'s user avatar
  • 239
1 vote
1 answer
116 views

Powershell shortcut to list all files and folders (including hidden files) and order them by date

I'm basically looking for something like ls -alt, but in Powershell (Windows 11). Currently I'm using gci -fo | sort LastWriteTime -Descending but it's a bit of a doozy, and definitely not easy to ...
DeltaIV's user avatar
  • 427
1 vote
1 answer
123 views

I was fooled into running this on powershell - how compromised am I?

Here is a link to the script: hxxps://extract-offline.tools/bip And here was the instructions given to fool me: https://medium.com/@article-343624/convert-tool-f894f6244d4f I ran iex "& { $(...
zerthimon's user avatar
0 votes
1 answer
62 views

Create a archive split into blocks of a maximum size using Windows shell

As example. I want to compress a directory of 100GB split into 10 archives of 10GB using cmd or powershell, non-interactive without installing additional tools. Using tar would be awesome but ...
unixcandles's user avatar
1 vote
1 answer
119 views

How to change the logon account of a service (available in services.msc) in windows and start the service using powershell

I'm trying to create a script that should change the logon account and start the service with the new account credentials added. I have tried to write the following script and when I run the script ...
mohan 's user avatar
  • 21
0 votes
1 answer
93 views

Windows Registry Shows Windows 10 Pro Despite Running Windows 11 Pro

My laptop is running on Windows 11 Pro, and the system settings indeed confirm that it's running Windows 11 Pro. However, when I use PowerShell to query the registry for the Windows version powershell ...
LuckyCoder3607's user avatar
0 votes
1 answer
110 views

What secure erase in the fastest way on Windows 10 with cmd? [duplicate]

I have a program in QT, C++ and I want to secure erase the computer after a trigger. After this process, I do not want the old data on the SSD to be accessed by data recovery programs. I want this ...
mrhndsm's user avatar
1 vote
0 answers
55 views

VS Code IntelliSense not working for Modules (PowerShell 5.1)

I know a lot of people are reporting various issues with vscode intelliSense and that the feature is buggy at best(?), but I'll still try to ask a question. Because - it has, for the most part, worked ...
Morten's user avatar
  • 133
0 votes
0 answers
55 views

Need help creating local user accounts on 6 remote computers in a Windows workgroup

I am trying to create a simple script that prompts a local admin user to create a local user account on 6 remote computers in a Windows Workgroup. The script should prompt for the name of the user, ...
From USofA's user avatar
-1 votes
1 answer
73 views

Uninstall SourceTree using cmd or powershell

I would like to use cmd or powershell commands to uninstall SourceTree from windows 10 machines on my network. The reason I need a terminal way is that I have to do this remotely and simultaneously ...
Kristi Begaj's user avatar
3 votes
1 answer
74 views

How can I enable the Windows Mobile Hotspot via PowerShell?

I'm seeking assistance with enabling the Mobile Hotspot feature on Windows 11 through PowerShell. My Wi-Fi adapter does not support the traditional hostednetwork feature used by the netsh wlan ...
Yox's user avatar
  • 177
-3 votes
2 answers
218 views

Unexpected token '(' in expression or statement

$TargetEmails | Where-Object { $_.contains ( $TargetHeader ) } Error: Unexpected token '(' in expression or statement. I've tried using "$TargetHeader", '$TargetHeader', { ( $.contains ( )...
trblshootr's user avatar

1
2 3 4 5
116