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.

learn more… | top users | synonyms

2
votes
1answer
28 views

How to know the file history that has been transferred from pc to usb device or vice versa?

When I want to know that if any usb device that has been plugged in a pc recently, I write this command in Windows Powershell. Get-ItemProperty -Path HKLM:\SYSTEM\CurrentControlSet\Enum\USBSTOR\*\* | ...
0
votes
2answers
27 views

How can I remove all but last 10 characters in a group of files

How can I rename a group of files like admin_ball_126608454.gma another_thing_384157357.gma to ds_126608454.gma ds_384157357.gma
0
votes
1answer
28 views

Rename a file and add a part of the file as the suffix of the file [duplicate]

I have file names like: A_20141001_20141224.txt A_20141002_20141224.txt B_20141001_20141224.txt B_20141002_20141224.txt C_20141001_20141224.txt C_20141002_20141224.txt I want to rename them to: ...
-1
votes
0answers
16 views

Powershell Script Execution from Excel. Access Issue

I have a powershell script which fetches HKLM/HKCU registry entries. I am calling this script from an Excel macro. Sub TestPowershell() Dim retval retval = Shell("powershell -ExecutionPolicy Bypass ...
0
votes
3answers
47 views

Use a variable inside a powershell string

I've got this currently on a single line in Powershell ISE Start-Process -filepath "C:\Powershell-Backup\disk2vhd.exe" -argumentlist 'C: \\Computer1\ServerBackups$\' + $ComputerName + '\' $JobTitle + ...
-2
votes
1answer
36 views

PowerShell: find line but include proceeding and preceding line(s)

This is a conceptual question that I have only briefly thought through my head. I have idea how I might do it but it seems more complicated than I think I will make it out to be. A common need is for ...
0
votes
0answers
13 views

How do I regain connectivity to a Windows Server after calling Powershell cmdlet Remove-NetFirewallRule?

I have some servers on AWS cloud. I accidentally invoked the PowerShell command Remove-NetFirewallRule and this has completely locked me out of the server. The server is joined to a domain. I have ...
1
vote
1answer
47 views

Self destruct directory

I would like running a script in a directory and then delete the directory, sub-directory and files. If(Test-Path -Path $var_InterventionManuelle) {Remove-Item -Recurse -Force ...
3
votes
4answers
6k views

Which are the non-x text editors in Powershell?

Are there some editors like emacs, vi/vim, specifically for power shell, if so which are the best? I will have to do some work on windows and I need some unix productivity - which means for me shell ...
1
vote
2answers
2k views

PowerShell script to copy files is having issue with directory path with spaces in it

I have a list of files to copy to/from different locations. Unfortunately, one of them has spaces in the subdirectory. Not all of them have subdirectories, and not all have spaces. This is a ...
7
votes
2answers
3k views

Powershell opening with ridiculously tiny font (about 5) and won't change to new default settings

Powershell is opening with extremely small font (about 5 pts). When I go to Defaults > Font, the setting is a reasonable 8 x 12 pixels but that is not what is showing on the screen. I try changing ...
0
votes
1answer
2k views

Call PowerShell script from Excel macro

I'm trying to call a PowerShell script from a macro in Excel. I have seen a number of examples along the lines of: retval = Shell("powershell ""C:\MyTest.ps1""", 1) When I try to use this, ...
0
votes
2answers
3k views

How to reset TCP/IP on Windows 8.1?

The following netsh command is not working on Windows 8.1. netsh int ipv4 reset It give “Access Denied” error and it is a VERY known issue, many people complaining about it all ove online forums. ...
0
votes
1answer
39 views

Tool That Converts Any Batch File Into Powershell

Is there a tool that can convert a batch file into a powershell script? My issue I'm having with batch files is that they are not running from the task scheduler, unless I stay logged in, and I'm ...
1
vote
0answers
49 views

How do I gain access to my C: Drive after completely locking it down?

I know the title might seem completely ridiculous but please read this before being biased. Okay, so I got myself into a real squeeze. I installed windows 10 technical preview for Enterprise on a ...
0
votes
1answer
30 views

Powershell script to open random video

I was looking for a way to open random video file in my folder which has about 400 videos (20 videos in 20 subfolders). I found a powershell script and managed it to work, but every time I run it I ...
25
votes
5answers
32k views

Copy and paste in Windows PowerShell

How do I effectively copy and paste input and output in the Windows PowerShell?
93
votes
7answers
68k views

Native alternative to wget in Windows PowerShell?

I know I can download and install the aformentioned library (wget for Windows), but my question is this: In Windows PowerShell, is there a native alternative to wget? I need wget simply to retrieve ...
1
vote
2answers
2k views

Download entire directory from a website using Powershell

I have been using the following command to pull back files from a web server and store them on my local machine: $client = New-Object System.Net.WebClient ...
5
votes
2answers
527 views

Equivalent of bash's Ctrl-r in PowerShell

does anybody knows of a way to have the backward command search feature of bash [Ctrl-r] (and [Ctrl-o]) that are so useful, in windows powershell ? C-r is a more powerful arrow up history ...
1
vote
2answers
300 views

Read x64 registry branch from 7-zip SFX Installer via PowerShell

I want my 7-zip self-extracting archive to run a PowerShell script after it extracts files. To do that, I use method described here: ...
0
votes
0answers
23 views

Powershell Refresh Script

This is a fairly simple script, but it doesn't always work. It worked once today, the first time I ran it. I believe it isn't opening the files in the path I specified on subsequent runs. I'm not ...
2
votes
1answer
208 views

need command line to test duplex status on windows NIC cards

this woud be for windows 7 I tried the following powershell command get-wmiobject Win32_NetworkAdapter | foreach-object { get-wmiobject -namespace root/WMI -class MSNdis_macOptions -filter ...
6
votes
7answers
7k views

Powershell font too small on Windows 8.1 - how to adjust?

Question: On my Windows 8.1 machine, I need powershell to configure office web apps. When I start powershell, for a blink of a second, it shows as it should, but then it gets resized, and the font ...
2
votes
2answers
29 views

Wait for process to exit using powershell

I had a little program in F# (similar to C#), that gets processes by name, then filters the particular one by its path and waits for it to exit: let processes = ...
0
votes
1answer
21 views

Invoke-item equivalent in git-bash?

Powershell allows you to open a GUI folder with the invoke-item command. Say I'm in C:\Family\Desktop, the command "invoke-item adam" allows me to open a GUI version of the adam folder. I've tried ...
0
votes
1answer
18 views

setting up variables and the results from a function within a string - all as a string in powershell

I am new to this and could use some assistance. I have the following function and trying to add the result from the function into the strings below. What am I missing to accomplish this? I just want ...
0
votes
1answer
13 views

How to remove a picturebox from a powershell GUI after it has been added?

I am creating a powershell tool that performs a specific migration of program data. One step I need to perform is to check whether SQL server can write to the specified file locations. I have a button ...
1
vote
1answer
90 views

Loop through files and remove part of filename

I need to remove the first 3 chars of every file in my directory. Here is my code: Get-ChildItem "D:\New Folder" -Filter *.txt | foreach-object -process {rename-item -path $_.FullName -newname ...
3
votes
3answers
7k views

Powershell Bug in copy/move/rename when filename contains [square bracket characters]?

Please pardon a noob question, but I've been completely baffled by this one. I have a "depositor" directory where user-submitted files arrive, and have no control over the incoming file names. I ...
1
vote
1answer
5k views

Calling PowerShell functions in another scripts

I have a script with a number of functions (not just functions but also other code). I would like to create another script that uses one of the functions in the main script. Here is a sample of what ...
2
votes
0answers
25 views

What's the difference between Remove-WindowsFeature and Uninstall-WindowsFeature? [migrated]

What's the difference between Remove-WindowsFeature and Uninstall-WindowsFeature? I've used Add- and Remove- on Windows 2008 R2 boxes, but there is now an Install- and Uninstall- which according to ...
4
votes
2answers
19k views

Concatenating Variables within Powershell

I'm trying to concatenate two variables within Powershell to form a complete file path and file name to save a text file. I have two variables $Log_path and $Log_name I'm trying to join the two ...
33
votes
10answers
19k views

Equivalent of Linux `touch` to create an empty file with PowerShell?

In PowerShell is there an equivalent of touch? For instance in Linux I can create a new empty file by invoking: touch filename On Windows this is pretty ackward -- usually I just open a new ...
1
vote
1answer
4k views

How to fix this WinRM error? (Set-WSManQuickConfig error)

On Windows XP Pro SP3, when I run Set-WSManQuickConfig (after agreeing to the new settings), I get this error: Set-WSManQuickConfig : <f:WSManFault ...
8
votes
5answers
11k 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, ...
0
votes
1answer
18 views

Using powershell, how do I extract the thumbprint from an SSL Certificate without installing it?

Every example I've found on StackExchange, and other internet forums, etc all tell me how to get the thumbprint from a certificate already installed into a certificate store. Alternatively, the ...
0
votes
2answers
15 views

Powershell - Start Process on Different Drive from Batch CMD

Problem: From the CMD or Batchfile, calling powershell and starting a process from a different drive or the -FilePath is failing.
1
vote
1answer
52 views

Powershell search-string inside a variable (not text file)

I am trying to search for a string called "Hostname" from a variable "$a" which stores the output of "systeminfo" command but ran into issues. I am using "system-info" to gather a bigger set of data. ...
6
votes
2answers
8k views

Is Windows PowerShell as powerful as the terminal of Unix/Linux? [closed]

Is Windows PowerShell as powerful and efficient as Linux' terminal? People offline tell me, without explaining much, that Windows PowerShell is an attempt to make Unix administrators feel more ...
7
votes
4answers
5k 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?
3
votes
2answers
9k views

Office365 Exchange: Cannot open shared two calendars in Outlook

The problem: Outlook won't open the calendars on another user's mailbox and and a room mailbox, even when users have permission. Note: This problem is affecting more than one account on more than one ...
0
votes
1answer
54 views

Restart a computer at a given time with PowerShell

I'm looking for a way to restart a computer with PowerShell (Restart-Computer), at a given time (Example: 03:00AM). The PS-Script itself will run at a random time, when the user executes it, so it's ...
1
vote
1answer
30 views

Grabing Mailbox Stats : How can I look at multiple OUs?

I have this Powershell code that grabs the mailbox stats from one OrganisationalUnit but how could I grab it from two others without running the code again seperately. How would I create an array of ...
0
votes
0answers
46 views

Powershell Network Copy Script very slow

We have a main files server for a local office, I placed a ESXI host in one of our data centres, I used the recursive copy function to create a small powershell script, and scheduled this for 9pm. For ...
2
votes
1answer
50 views

Focus IE window in powershell [closed]

My code: $ie = new-object -com "InternetExplorer.Application" $ie.navigate("http://localhost") $ie.visible = $true $ie.fullscreen = $true However, after fullscreen, the window still appears behind ...
2
votes
2answers
2k views

How do you install .net4 on a Server 2008 r2 machine through psremoting in powershell?

I need to write a script that installs .net 4 remotely using powershell to a group of Server 2008 R2 machines. I based my script off of ...
-1
votes
1answer
37 views

PowerShell script to retrieve local group member data

I am trying to pull out from hundred of servers information into Excel spreadsheet about all existing local groups including their members with account status. I have a server list - servers.lst for ...
-1
votes
1answer
42 views

Powershell to compress files and send email

Powershell to compress files and send email. I want to 7zip backup file and send as an email. Below i have done till now which will read text files and send as email. Instead i want to send all the ...
0
votes
0answers
25 views

WmiEvent for any usb device

I am following this answer, which contains Register-WmiEvent -Class win32_VolumeChangeEvent -SourceIdentifier volumeChange and $newEvent = Wait-Event -SourceIdentifier volumeChange This works ...