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
1 vote
0 answers
12 views

Rename subfolders from a CSV

I have a structure with multiple subfolders and I would like to rename the file and (sub)folders by introducing a code with a structure as follows: 1 (folder) 1.1 (subfolder) 1.1.1 (file) or ...
user avatar
  • 11
1 vote
1 answer
36 views

Why does "Out-File" seem to ignore the "Encoding" parameter?

I'm trying to save output to a file: SFC | Out-File -FilePath out.txt Now if I open out.txt in Notebook, I expect to see You must be an administrator running a console session in order to use the sfc ...
user avatar
  • 127
0 votes
0 answers
29 views

Need to automate cleanmgr silently with the "Clean Up System Files" [closed]

This has been a very difficult undertaking. I am trying to write a script (bat or powershell) that will silently clean up everything you see in cleanmgr BUT with the "Clean Up System Files" ...
user avatar
  • 1
0 votes
0 answers
12 views

Script to Edit Local Group Editor For Blocking the Password In Edge & Chrome [closed]

I am pretty new at scripting & I have been tasked with creating a PowerShell script that we can use to edit Local Group Policy Editor so that we can block the password save prompt in Edge and ...
user avatar
0 votes
0 answers
14 views

Network share access denied after STIG/CIS hardening in windows

I have one windows server from where I was running robocopy and it was working. The source was a network share from where I was copying some files to this windows server. After implementing CIS/STIG ...
user avatar
0 votes
0 answers
32 views

Was my wsl installation erased by reboot? [closed]

In a computer with windows at a corporation, where there's control over computing, I successfully installed windows Linux subsystem in power shell using admin account by wsl --install But I didn't ...
user avatar
  • 16.3k
0 votes
0 answers
18 views

Update / Reboot status monitor

I am periodically surprised on my servers when they reboot on their own schedule. We do a manual reboot weekly but sometimes the automatic reboot also happens and it is disruptive. MS allows me to ...
user avatar
0 votes
0 answers
34 views

How to change Powershell Set-Location behavior?

Let's say i have a folder named C:\PROG. In Powershell, if i type CD c:\prog, it changes to correct location, but somehow it stores location internally as C:\prog, instead of C:\PROG. Is there a way ...
user avatar
1 vote
1 answer
14 views

Unread e-mail in Office 365

With Office 365. I would like to know how I can obtain a file, or list of all user's unread e-mail count, not necessarily the detail. I understand this is a moving target. I'm fine with that. I'm ...
user avatar
0 votes
1 answer
29 views

Adding AD group to another AD group powershell script

When a server gets created an AD group gets created that has the server name in it (xxxServerNamexxx). I have a pre-written script to install IIS locally on the server. At the end of the install I ...
user avatar
0 votes
0 answers
17 views

How delete windows logs with powershell & cmd command in period of time [closed]

I am curious that how can can i delete windows logs with PowerShell & cmd command in period of time? Period of time mean only delete specific logs related to last two month. Please show all ...
user avatar
1 vote
1 answer
46 views

On Windows 10/11, change system settings via command line (either PowerShell or CMD) without opening Settings

Title is pretty straightforward, but some background to help elaborate; I'm attempting to, in Godot Engine, create a "desktop environment" of sorts for Windows -- think the ages of Microsoft ...
user avatar
0 votes
0 answers
24 views

Disk Cleanup Powershell script

I use this powershell script to clear the system drive (usually drive C). I store it in a USB drive and run it but I found it also tries to clean my USB drive. Please help how to limit the operation ...
user avatar
  • 45
0 votes
1 answer
40 views

Execution Policy Powershell

I created a folder named Scripts in the c:\ drive, move my 2 scripts that were on my Desktop screen to this folder. When I go to run any of the scripts the powershel screen opens and closes quickly ...
user avatar
  • 375
2 votes
1 answer
156 views

How can I make CMD load normal system commands by default? (command prompt / powershell)

Please see below screenshot, this is pretty much self explanatory. All default programs in System32 aren't being loaded and can't run unless I specify the exact directory and path of the program ...
user avatar
  • 1,264
0 votes
0 answers
11 views

How to read/fetch data from Oracle SQL database using PowerShell Core?

I have been researching on this for a couple of days but have been going in circles here. I need to write a script that fetches the data from Oracle db and do something with the data. In my script I ...
user avatar
  • 13
0 votes
1 answer
30 views

sc stop winDefend/deleting MpCmdRun.exe access denied

I am trying to stop windows defender service as an administrator but I am getting access denied error. The intention is to remove "MpCmdRun.exe" file after stopping service. I tried changing ...
user avatar
0 votes
1 answer
48 views

How can I see the exit code of a program running in the PowerShell console

I really need to check out the numerical value of a command that I run in Windows PowerShell. The $? only returns True or False, but I need the actual error number. Is that possible? In linux is just ...
user avatar
  • 105
-1 votes
0 answers
41 views

Been Hacked by Powershell Script Hidden As Jpeg [duplicate]

I have clicked on a shortcut which triggered a bash that renamed jpeg file and hidden installation. I am not that good with coding but as far as i understood it created a service and scheduled a task ...
user avatar
-2 votes
1 answer
35 views

Looking for a PowerShell or other script/batch file that will replicate a video file over and over to fill an entire hard drive [closed]

Looking for a PowerShell or other script/batch file that will replicate a video file over and over to fill an entire hard drive. Is this possible? Every sector. Basically like a killdisk but instead ...
user avatar
0 votes
1 answer
26 views

Restart powershell script

My script counts the audio files on the PC and checks if the drive entered in the input is the system drive. If it is, a message is sent to Return or Exit the script. I created the :INI and :EXIT ...
user avatar
  • 375
0 votes
1 answer
30 views

Proper path for client's "Local Group Policy" in PS' NetSecurity module

So, by default default, Windows client OSes (and servers too, to a degree) have 2 default Windows Firewall policies: weird local firewall and local group policy. In netsh you can easily switch between ...
user avatar
  • 1
0 votes
1 answer
33 views

Creating an alias in Powershell that includes a space (for a parameter)

I want to start the control panel applet RunDll32.exe shell32.dll,Control_RunDLL via an alias in PowerShell. Running it directly works fine but when I set an alias: set-Alias controlpanel "...
user avatar
  • 7,599
0 votes
3 answers
44 views

Batch Rename Files by Switching Two Parts of the Name

I'm new here and don't have any coding knowledge or experience or software, but I use Windows 10. I have LOTS of files named like:(1) 2020-03-12.mp3(7) 2021-04-10.mp4(6) 2022-08-25.docxetc.They're mp4,...
user avatar
0 votes
0 answers
11 views

Run Powershell script after the first one finished [migrated]

How to modify the code be more neatly to make the first powershell function finished before starting the next one. Echo Clean Windows\Temp Folder Powershell.exe -Command "& {Start-Process ...
user avatar
  • 45
0 votes
1 answer
31 views

Get-ChildItem -Recurse with File Shares

I want to list all file names on my file server. The -Recurse option works within a file share. $shareName = "\\myFileServer\myShare01" Get-ChildItem -Path $shareName -File -Recurse | Select ...
user avatar
  • 26.8k
0 votes
1 answer
30 views

powershell multidimensional Array foreach

Powershell script (win10) function eineFunction($meinHost, $meinPass){ Write-Host $meinHost "--" Write-Host $meinPass "--" } $MeineHosts=( ("host1",...
user avatar
0 votes
2 answers
44 views

If I use Powershell with "-NoLogo" to hide the "logo" text, can I be told/figure out if Powershell detected that I'm running an old version of pwsh?

I am using Powershell 7 (core?) on Windows 10/11, and I get this kind of output when I start Windows Terminal: PowerShell 7.2.3 Copyright (c) Microsoft Corporation. https://aka.ms/powershell Type '...
user avatar
0 votes
0 answers
23 views

Script to copy Exchange Distribution Groups from one user to another

I am hoping to get some help with a script to copy Exchange group permissions from one user to another. I currently have a script that works to copy mailbox permissions from one user to another but ...
user avatar
  • 1
1 vote
0 answers
36 views

How to turn off "Always run as administrator"/ "Run this program as an administrator" on Windows 10/11 with CMD or PowerShell? Is this Possible

Is this possible to turn off "Always run as administrator" on Windows 10/11 with CMD or PowerShell for any specific program? I have to off "Run this program as an administrator". ...
user avatar
  • 57
0 votes
1 answer
32 views

PowerShell Script Has Wrong Icon and Context Menu Items

I have a .ps1 script on one of my computers and it looks like this: When I right click and bring up the context menu, it has an "edit" entry. However, when I copy the same PowerShell script ...
user avatar
  • 896
0 votes
0 answers
19 views

automatically download file from behind McAfee Web Gateway

I want to automate downloading files behind McAfee Web Gateway so that anytime I update a library, I don't need to repeat ... For reference, I came across: https://stackoverflow.com/questions/23413920/...
user avatar
  • 979
0 votes
0 answers
28 views

USB has a shortcut of the usbpen itself and this affects every usb I plug into my pc

I'm writing hoping to solve this problem that is affecting my pc since February 2022. Basically, when I plugged my USB pen into my pc, a .lnk file appeared, and in this file I can find my files. If I ...
user avatar
0 votes
0 answers
22 views

Windows firewall - stop all programs from accessing the internet with exceptions, ideally in powershell

I'd like to use Windows Firewall outgoing rules to block all programs from accessing the internet except the following: c:\zx\CertifyTheWeb - an app which refreshes IIS certificates World Wide Web - ...
user avatar
1 vote
0 answers
26 views

How to add Virtual Machines to Log on as a service Properties in command line?

Following this question, I have found this page instructing to add "Virtual Machines" in Computer Configuration > Windows Settings > Security Settings > Local Policies > User ...
user avatar
  • 418
-1 votes
0 answers
28 views

Windows Equivalent to `sha256sum -c` (cryptographic hash, digest file, recursive integrity check, SHA256SUMS)

What is the equivalent to sha256sum -c in Windows? I have a set of very important files that I need to copy-to and mirror across many different types of disks in many geographically distinct locations....
user avatar
0 votes
0 answers
12 views

Powershell Script to Fade Audio gradually to Mute And toggle to Original Volume

I cannot for the darndest identify why this script does not function as intended - What am i missing , Audio function found here. Removed from the start of the code for readability. $volumestate = [...
user avatar
0 votes
0 answers
19 views

bcdedit specified entry identifier not valid on command prompt

Context: I have Ubuntu and Win11 installed, but I access directly to Win11. If i run bcdedit I get: Administrador de arranque de Windows ---------------------------------- Identificador {...
user avatar
0 votes
0 answers
34 views

"WARNING: UNPROTECTED PRIVATE KEY FILE!" - can not sign in to VPS Ubuntu-account from local Windows 10 computer

Following this authoritative article, I created the SSH keys at Windows local PC and copied them to VPS (this article does not cover the Windows case, but I found appropriate solution). Now, when I ...
user avatar
0 votes
0 answers
39 views

Why is switching the quotation marks necessary for certain cases in Powershell on Windows?

Yesterday, I was trying to use git-filter-repo to rewrite my project's Git history and update the author/committer details with the following command. git filter-repo --commit-callback ' old_email = ...
user avatar
  • 71
0 votes
0 answers
20 views

Need to run determine whether I can reach FTP server, through firewall?

I have an ftp server on a cloud VPS instance. The IP can be obtained from a domain like myvps.example.com. I would need to run a powershell script across a variety of computers that are sitting behind ...
user avatar
  • 1
0 votes
1 answer
42 views

Powershell rename files

I need to rename over 1000 files with Powershell but need help as I am not that familiar with the tool...tried already many codes but they didn't work :-( Here some example files: 342453-gggssd - Mike ...
user avatar
  • 1
0 votes
1 answer
46 views

List all user accounts with an active presence on the local device

I need a way in PowerShell (ideally PS2.0+) to list all user accounts on a local system where a user has a local presence, but where users may not be local users per se. That is to say that the device ...
user avatar
  • 5,148
0 votes
1 answer
29 views

Getting a file name, followed by Write-Host (PowerShell 5.1)

I'm sure this has probably been answered before but Google-fu seems incapable of locating what I'm looking for. I'm attempting to write a script which will take a user input for a file name (a FQDN). ...
user avatar
0 votes
0 answers
25 views

recursively delete a specific directory for each user in C:\Users

Would like to use powershell to loop through all C:\Users\* and delete all contents of a subdirectory... Some users, but not all, use an app that creates cache files at: C:\Users\UserName\AppData\...
user avatar
  • 101
0 votes
0 answers
31 views

How to replace Symlinks with the files they point to on Windows 10?

I am trying to batch replace symlinks in several folders with the original files that they point to. The only solutions I've come across are Linux/Unix/Bash scripts as shown here: Replace Symbolic ...
user avatar
  • 49
2 votes
1 answer
75 views

Powershell history isn't persistent anymore

Powershell stopped using its persistent history (Windows 11). When I start a new Powershell instance commands from previous sessions don't show up. Once I use commands in the new session for the first ...
user avatar
  • 7,599
0 votes
1 answer
60 views

How to disable Bluetooth device power management in Windows 10?

I have a Bluetooth audio device that I use to play sound from my computer. When playing music from a software, it works as expected. When using it with remote conferencing software like Ms Teams or ...
user avatar
  • 101
1 vote
1 answer
76 views

Changing PowerShell 7.2.2 color scheme to the default PowerShell 5.1

As you can see the image below on the left shows what my PowerShell 7.2.2 looks like and the image on its right shows what my PowerShell 5.1 looks like. I want to brighten the colors of my PowerShell ...
user avatar
0 votes
1 answer
60 views

Powershell Get-ChildItem do not show subfolders

I used pushd \\network\drive\path to move into this drive in powershell. Then I used Get-ChildItem to check to which folders I can move from here. Unfortunately the results of this command is empty, ...
user avatar
  • 101

1
2 3 4 5
99