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.
447
questions
4
votes
2
answers
15k
views
Powershell auto complete settings.
I was wondering if there was anyway to change the way the current powershell autocomplete works. I have been using bash and had changed them to offer a few features that I'd like in my powershell ...
4
votes
1
answer
2k
views
How to use Powershell Remote across the internet?
I know that Powershell can be used on local network.
But what if the computer that I want to manage is not on the same Lan as mine?
We are each on a seperate LAN and both are behind a firewall.
How ...
4
votes
3
answers
8k
views
Is there a limit to the number of IP addresses for a Windows Firewall rule's Scope?
I've got a Powershell script that adds IP addresses trying to run brute force attacks on my server to a firewall rule that blocks them from accessing it. Recently it stopped working, and started ...
3
votes
2
answers
4k
views
Keep outlook 2010 open [duplicate]
Possible Duplicate:
How to make Outlook 2010 minimize when I try to close it?
I want to "disable" the ability to close Outlook2010. I always "close" it instead of minimizing it.
What are some ...
3
votes
1
answer
5k
views
Unable to SSH to my virtual machine via Windows Power Shell ISE
I have a Linux VM guest running in my vmWare host that I want to access using Windows PowerShell ISE. I normally can SSH to my VM, but I cannot with Windows PowerShell ISE.
When I try to do SSH to my ...
3
votes
2
answers
2k
views
Backup Modified PowerShell Console Colors Properties (Windows 10)
I don't quite understand how this works. So when I open up PowerShell as administrator, I can right click on the title bar, go to "Properties," then go to "Colors" and make changes. For example, I ...
2
votes
3
answers
49k
views
configuring Outlook with powershell
I have made this script to reset outlook profile and configure a new profile.
this script is deleting the old profile and creating a new one and launches outlook... I want that after launch of outlook ...
2
votes
2
answers
315
views
Windows 7 Powershell
I asked this same question on my original account that I no longer have access to. Yesterday when I turned on my computer a tab opened that is just a blue screen called
C\WINDOWS\System32\...
2
votes
1
answer
27k
views
Can't remove iis from Windows Server 2012 R2
I'm trying to uninstall IIS from Windows Server R2. I tried Service Manager -> Remove Roles and Features, uninstalling ran, the restart computer, but it's still there. I tried also to do it by ...
2
votes
1
answer
3k
views
PowerShell, how to disable Xbox Game Bar?
I really need to disable the Xbox Game Bar with PowerShell. There are many articles on how to delete/uninstall the Xbox Game Bar but that does not work for me as I need this inside Windows Sandbox (...
2
votes
0
answers
801
views
Powershell can't see "git" or "node" commands while cmd can
Using Windows 10, I can't run certain commands from PowerShell but they all work correctly using cmd.
PowerShell:
node --version:
node : The term 'node' is not recognized as the name of a cmdlet, ...
2
votes
6
answers
13k
views
Running powershell script through Windows Task Scheduler
I'm trying to run a simple PS1 powershell script from the Task Scheduler. The task's Actions settings are Program: powershell and Add arguments: -executionpolicy bypass -file C:\Users\Robin\Documents\...
2
votes
1
answer
2k
views
Getting SID from win32_groupuser
I am trying to get the SIDs of users and groups by querying
get-wmiobject -query 'select groupcomponent,partcomponent from win32_groupuser`
output:
__GENUS : 2
__CLASS : ...
2
votes
2
answers
4k
views
Open the start menu using Powershell
Am currently working on a business process automation software and literally user actions are simulated by robots. I need to pass some information to the start menu of my windows 7 and i was wondering ...
2
votes
2
answers
1k
views
Move a copy of unknown named images and rename - Powershell or Batch Script
Copy first ten jpg files in folder in alphanumerical order to new folder with out prior knowledge of jpg file names.
Give each ten files in new location specific names like 'e100.jpg' - 'e110.jpg'.
...
1
vote
1
answer
6k
views
Search and replace registry entry value using powershell
I'm trying to update a set of registry keys, a set of properties need to be updated with a new value based on the old value.
I tried using the following:
Get-ItemProperty -Path HKCU:\Software\xxxxx\...
1
vote
2
answers
2k
views
Change folder name with the name between ( ) with powershell
I have a folder structure and in all the folders there is a part between ( ).
Like "folder example(12345)"
Now I must rename all the folders with the name that is between ( ).
So the result ...
1
vote
2
answers
17k
views
Uninstall an application without user input
Below is a PowerShell script I am running on Windows 10 to uninstall HP Support Assistant but it keeps prompting the end-users for input and such, and this is what I need to prevent.
Question: How can ...
1
vote
1
answer
1k
views
More than one 'Open xxxxx here as Administrator'
I want the option to open a Command window or Powershell window as Administrator from the drive and directory context menus in Windows.
I can have either by creating and populating the special '...
1
vote
2
answers
3k
views
Opening PowerShell at the current working directory from the registry
This question is prompted by a problem I faced while writing this answer. I am invoking PowerShell like this from the registry:
C:\Windows\System32\WindowsPowerShell\v1.0\PowerShell.exe -NoExit -...
1
vote
2
answers
2k
views
Batch create folders?
I'm looking for a way to batch create a folder followed by sub-folders.
I'm looking at something like
c:\users\user\desktop\sample\1
c:\users\user\desktop\sample\2
etc.
Any ideas?
I'd prefer .cmd/...
1
vote
3
answers
2k
views
Trying to use batch file in one location and call powershell script elevated
I am trying to use the below batch file which finds the CD drive on the machine and want to launch a powershell script from the CD and run within this folder. Here is the batch file.
@echo off
...
1
vote
1
answer
84k
views
Running runas cmd in Powershell
I am a beginner and am trying to understand how to use the runas command in Windows Powershell.
When I type the following command into Powershell:
runas /user:<localmachinename>\administrator ...
0
votes
1
answer
886
views
Colon in filename creates pseudo folder. How do I see what's inside?
I can create a file with a colon : in the name. I am given to understand this should not be possible in Windows. I originally did it by copying text with a colon : into the filename to save a text ...
0
votes
2
answers
2k
views
PowerShell, why does CreationTime expect US date format while system has European date format?
I've digitised my old VHS tapes and it's now quite a lot of separate files. I want to set the filedates to the 'original' dates of the events, so that I can sort them chronologically.
This can be ...
0
votes
2
answers
2k
views
Word counter -- Batch
I want to make a batch-script that counts the times that the word "parent" appear in the file,
http://api.github.com/repos/godzillamesel/disclovestory/commits
I'm currenly downloading this file ...
0
votes
1
answer
1k
views
How do I renaming files in a batch with a counter?
I have 14,000 picture sorted into files by year and month but taken with multiple cameras. I want the file name to reflect the date the photo was taken.
For example, all pictures taken on October 16,...
0
votes
2
answers
620
views
How to save the XML file using powershell script
I have an XML file with the below content
<?xml version="1.0" encoding="utf-8"?>
<Topology>
<SERVER1 desc="name of server1"></ICONIS_ONLINE_SERVER1&...
0
votes
1
answer
81
views
Replace multilines file every time a certain string occurs in another file with powershell, batch or Notepad++
I have a file with about 50 thousand different lines of text that needs to be placed into another file (with 500 thousand lines) every time this string occurs:
[2]
1 string data = "
This string ...
0
votes
1
answer
593
views
Powershell overruling Perl binmode?
I have a Perl script which creates a binary file while scanning a very large text file. It outputs to STDOUT which I redirect in the commandline to a file.
To optimize it I'm making changes then ...
0
votes
1
answer
2k
views
wsdl : The term 'wsdl' is not recognized as the name of a cmdlet
How to use the wsdl command from Windows 10?
PS C:\Users\thufir>
PS C:\Users\thufir> wsdl http://holidaywebservice.com/HolidayService_v2/HolidayService2.asmx
wsdl : The term 'wsdl' is not ...
-1
votes
1
answer
1k
views
How to set up Windows on VM using Powershell (Hyper-V)
I know how to create a VM and I know how to start that VM on Hyper-V using the script of Powershell but it's the first use of the VM so I need to set up Windows and I don't know how using the ...
549
votes
5
answers
762k
views
How do I run multiple commands on one line in PowerShell?
In a cmd prompt, you can run two commands on one line like so:
ipconfig /release & ipconfig /renew
When I run this command in PowerShell, I get:
Ampersand not allowed. The `&` operator is ...
215
votes
9
answers
619k
views
PowerShell equivalent of curl
Is there an equivalent of curl in PowerShell? Does it have some similar built-in capability or is there a 3rd party cmdlet?
188
votes
9
answers
128k
views
PowerShell equivalent to the Unix `which` command?
Does PowerShell have an equivalent to the which command found in most (if not all) Unix shells?
There are a number of times I'd like to know the location of something I'm running from the command ...
138
votes
11
answers
421k
views
Copy and paste in Windows PowerShell
How do I effectively copy and paste input and output in the Windows PowerShell?
124
votes
16
answers
467k
views
Delete all files from a folder and its sub folders
I want to remove all files from a folder structure, so I'm left with an empty folder structure.
Can this be achieved in either batch or VBScript scripting?
I have tried a very basic batch command, ...
105
votes
4
answers
252k
views
have Powershell get-childitem return files only
I'd like to use get-childitem recursively, but only have it return files not directories. The best solution I have just doesn't seem natural:
gci . *.* -rec | where { $_.GetType().Name -eq "FileInfo"...
93
votes
3
answers
55k
views
Disable PowerShell beep on backspace
This feature seems to have been added in PowerShell version 5.1, as I don't find it on my laptop still running 5.0.
When pressing Backspace in PowerShell, it will emit a 'beep' sound if there is no (...
67
votes
2
answers
68k
views
How do you create a new symlink in windows 10 using powershell (not mklink.exe)?
If there's docs on it, I'll take that. Any web searches for "symlink" "symbolic link" "windows [10]" "powershell" returns everything except the base command.
Even the powershell docs site returns ...
67
votes
4
answers
59k
views
Powershell equivalent of `grep -r -l` (--files-with-matches)
In Powershell, how do I list all files in a directory (recursively) that contain text that matches a given regex? The files in question contain really long lines of incomprehensible text, so I don't ...
64
votes
5
answers
165k
views
How to find WSL2 machine's IP address from windows
This question is related to my question about making a WSL2 address static. Since that looks like it isn't possible I am trying to come up with a workaround.
I am thinking I can run a shell script in ...
61
votes
7
answers
291k
views
netstat with process name?
Using netstat -a -o -n I can get the list of ports and PID
then I need to go to task manager and add the PID and see who is it.
(pretty frustrating)
I was wonder if there is a CMD command which ...
59
votes
5
answers
133k
views
Changing last modified date or time via PowerShell
Is it possible to change a file or folders last modified date/time via PowerShell?
I have a folder folder1/ and I want to change the last modified date and time of that folder and it's contents via ...
56
votes
1
answer
32k
views
Does Powershell have any sort of .bashrc equivalent?
I have some functions I'd like to load by default when I open an administrative powershell. Is there any equivalent to say .bashrc or .profile that I could use to automatically import the scripts ...
50
votes
5
answers
92k
views
Windows PowerShell equivalent to Unix/Linux `pwd`?
In follow-up to the cmd.exe question, what is the PowerShell equivalent to echo %cd%, or Linux/Unix pwd?
47
votes
3
answers
30k
views
Replacements for ampersand and double-ampersand in PowerShell
In Windows' native CMD processor, you can use & to string commands together so that one runs immediately after the other. A && will run the second command only if the first completes ...
46
votes
7
answers
66k
views
tmux/screen alternative for powershell
Is there an alternative to tmux/screen that would work on Windows with Powershell? I'm aware of Powerscreen, but it seems dead for a long time. Cygwin wouldn't work with Powershell, would it? Console2 ...
42
votes
1
answer
56k
views
Equivalent of bash's `source` command in Powershell?
To run a bash script line-by-line (so as to preserve environment variables, for instance), one does the following:
$ . myscript.sh
Or:
$ source myscript.sh
I have a PowerShell script that - among ...
42
votes
5
answers
66k
views
Run Powershell script when you open Powershell
Is it possible to run a Powershell script when you run Powershell? As in, double click the Powershell icon and open the window. Is there some type of "auto-run" setting somewhere?