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

1
vote
1answer
365 views

one-click script o backup and restore individual registry keys

I have an application that stores some settings in registry. For whatever reason, it loses some stuff on occasion. I don't really have time to figure out what the problem is (it's not even guaranteed ...
3
votes
1answer
343 views

Powershell scripts works manually but not as a scheduled task

I have a powershell script that converts .doc to .pdf files. When I execute it manually, it works perfectly on my windows server 2012. When I execute it as a scheduled task, opens an instance of ...
1
vote
1answer
723 views

PowerShell remoting authentication

When I am logged in as the same user as the server, I can Enter-PSSession with: > Enter-PSSession -ConnectionURI http://xxx.xx.xxx.xx:5985 However, when I'm logged in as a different user (on the ...
1
vote
2answers
87 views

How to Add Scripts to Path?

I've stored commonly used powershell scripts at %USERPROFILE%\Bin. I created a USER_BIN environment variable which I added to the user PATH environment variable via Control Panel > System and ...
0
votes
1answer
23 views

Should I delete data before deleting its partition and extending over?

I have multiple computers with the main drive split into C and D partition. D just has random data, C has the OS. I plan on copying over data from D to C then deleting D and extending C over it. Can I ...
1
vote
1answer
194 views

Piping all output from Get-ChildItem

I'm trying to make a basic powershell command work, but I'm having some difficulty with the piping system. I'm using Fossil for my version control system, and have made the majority of my programs ...
2
votes
3answers
673 views

Using the .NET Framework ArrayList Class - How to find methods

How can I find what methods and properties the ArrayList class has? I am a junior sys-admin, teaching myself Powershell. I know about coding, what a dog knows about a clock. In Powershell I can ...
0
votes
2answers
91 views

Concrete cases for CMD/BATCH use [closed]

Please excuse my inexpertise. I don't have much experience with the command line. From my searches, the main reason for CMD use(*) is automation. I haven't, though, found concrete cases. Most ...
0
votes
1answer
251 views

Powershell won't start, fails with 'Value cannot be null. Parameter name input'

I have a brand new install of Windows 8.1 with Visual Studio. Running Powershell opens a window that closes immediately. Launching powershell from cmd.exe, I get the following error: Windows ...
2
votes
1answer
794 views

Powershell Rename Multiple Files with LastWriteTime Prefix

I am trying to put together a Powershell script that will: -Search recursively from a root directory -Exclude files with existing "yyyyMMdd " file name prefix -Rename the files not excluded above ...
0
votes
1answer
102 views

How to list a file and execute in powershell

I am trying to get the file names in a directory which are exe and then execute them one by one: $files = get-childitem mydirectory foreach ($file in $files) { $file /s } But somehow the ...
0
votes
1answer
69 views

How do I Refresh my shortcut file in Windows 8.1

OK so I was trying to change the color of the tiles in Win 8.1 and came across this link Customising Start Menu However I didn't understood the Step 7 and have no idea what do do that. I created the ...
4
votes
1answer
539 views

Environment.OSVersion in PowerShell vs PowerShell ISE

Why is it that I see 2 different versions of my OS from PowerShell and PowerShell ISE? The OS: Microsoft Windows Server 2012 R2 Datacenter Evaluation PowerShell: version 4.0 PowerShell PS C:\> ...
2
votes
2answers
84 views

Windows command line to do 'Edit' action?

The start command (in PowerShell an alias for Start-Process, in cmd.exe a shell builtin) does the same as the Windows Explorer context menu 'Open' action: it opens the file using the application which ...
1
vote
1answer
92 views

Vim & Powershell - send selection to command

I have a list in a file, and lets say I want to send it to the sort cmdlet (which is just for describing purposes, any cmdlet could act as a filter) My vim shell setup is: set shell=powershell set ...
0
votes
2answers
218 views

Powershell: gci filter with compact output

I want to find files recursively, and for that I am using > gci -name -filter *.py -r Option -name gives only the file name, to get one line per item found, as required. But the items that I get ...
1
vote
2answers
184 views

PowerShell: Env: Avoid truncation of environment variables

PowerShell displays environment variables, one line for each. If a variable has a long enough value, it is truncated, and appended an ellipsis: > gci env: Name Value ...
1
vote
0answers
68 views

How to pipe a group of files through a .exe using powershell?

I am currently using a .exe named "vbadecompiler.exe" to process a group o ".xlsm" files. Those are to many to process manually therefore Powershell seems like the answer. My current attempt is the ...
7
votes
1answer
2k 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 ...
1
vote
1answer
1k views

Powershell/CMD command to open IE10 in compatibility mode

I am looking for a powershell command to open Internet Explorer 10 in compatibility mode like C:\Program files(x86)\Internet Explorer\iexplore.exe www.abc.com opens www.abc.com in IE10. I want to ...
1
vote
1answer
538 views

Can logon script be assigned to a user in a windows machine which is not a part of domain through powershell?

This is the suggested way to add a logon script to a local user in Windows. http://technet.microsoft.com/en-us/library/cc770908.aspx Edited: I also found the following : ...
4
votes
2answers
632 views

Who is the Inventor of Windows PowerShell [closed]

Purely out of curiosity, who is the inventor of the Windows PowerShell ? As I have seen it on every Windows machine. So could someone please give me an insight on who the inventor of the Windows ...
1
vote
1answer
407 views

Is there a PowerShell cmdlet to enable Hyper-V “Enhanced Session Mode Policy”?

I am running Hyper-V on a Windows Server 2012 R2 system, which is getting staged via SCCM. Now I am wondering if there is a way to enable enhanced session mode policy using powershell. Unfortunately i ...
0
votes
0answers
47 views

Error while creating home directory for a local user account through powershell

I have seen the following as a suggestion to create home directory for a user. So I have tried the following script to create a home directory : $sec_password = ConvertTo-SecureString ...
0
votes
0answers
40 views

HomeDirectory is not getting created through powershell scripts

I tried the following to create a user and assign a home directory to the user. $comp = [ADSI]'WinNT://localhost,computer'; $user = $comp.Create('User', 'account14'); $user.SetPassword('Welcome1$'); ...
1
vote
1answer
2k views

How can a PowerShell script be automatically run on startup?

I have a PowerShell script to monitor an image folder. I need it to run automatically on startup. I tried to use MSConfig, but I could not find it in that list. How can I have the script ...
0
votes
0answers
195 views

Monitoring a folder using PowerShell

This script will monitor a folder, if new images are created, move them to the image folder. Very simple. But I got it partially working. The problem is only old images are moved; newly created ones ...
4
votes
2answers
1k views

Windows Backup Using Powershell

I wrote the following Powershell Script to perform a one time backup of my Windows Server 2008 R2 machine. The idea is to perform a Weekly backup to a different external drive and schedule the script ...
1
vote
0answers
125 views

Trying to make a symbolic link to a Powershell script

I'm trying to create a symbolic link with mklink through a Powershell script to a Powershell script on a remote server. this link should come on the desktop of all users. if(!(test-path -path ...
0
votes
0answers
48 views

How to print a document and set it to use colors using a script?

I have tried something like this on Powershell: $excelApp = New-Object -comobject Excel.Application if ($args.Length -lt 1) { Write-Host "Please provide full path and filename (ie: ...
4
votes
3answers
3k 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
1answer
144 views

Making PowerShell assume the working directory of a called Batch file

I regularly work interactively with a batch script that I can't easily change. One of the features of this script is as a navigation aid - it understands my company/product's code layout conventions ...
0
votes
1answer
2k 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
0answers
71 views

Need PowerShell or BAT to delete PST if over certain size for GPO

I'm trying to delete "Internet Calendar Subscriptions.pst" from %LOCALAPPDATA%\Microsoft\Outlook using a BAT file. I can do this fine. But how do I delete only if it is over a certain size? When end ...
0
votes
1answer
586 views

Running RSAT Tools as another user using Powershell

What I try to accomplish is running some RSAT Tools out of a Powershell-Script as another user (Domain-Admin). Here is my run code: Start-Process -FilePath "C:\Windows\system32\mmc.exe" ...
5
votes
4answers
439 views

Color empty files in Windows

I face a need to show empty (0 bytes size) files in color in Windows Explorer. (I get them over sftp and need to know whether they're empty to prevent data loss - an application creates empty files ...
1
vote
0answers
336 views

Can not create process with elevated permissions from LocalSystem account

I am running a build server on windows server 2008 (team city). The builds are run by the Team city agent that runs as a windows service under LocalService account. One of the builds need to copy a ...
1
vote
3answers
537 views

Executing PowerShell script via explorer context menu on items containing ampersands in their names

I'm using a slightly modified version of the technique given in this answer to create a context menu item in Windows' file explorer that allows me to run a PowerShell script against specific folders. ...
1
vote
2answers
92 views

Any way to set the default width for out-file?

In Powershell, redirection to file can be done with eith > or out-file, and from what I read > is basically a shortcut for the latter. The problem is that, by default, out-file wraps lines at ...
0
votes
2answers
92 views

Why does running Powershell script line by line work, but the same thru executing script file - does not?

In Windows 7 Prof, executing in Windows Powershell_ISE (as administrator) the Powershell (ver. 3) commands produces expected result (of adding a domain user to local/machine Administrators group) but ...
0
votes
1answer
309 views

Can the default PowerShell terminal keep a command history?

Is there a way to have PowerShell remember commands entered during the previous sessions? That is, after closing the window and opening it again, can PowerShell be setup to remember the commands?
3
votes
1answer
2k views

PowerShell - copying a file to multiple locations

I need assistance with a simple PowerShell script. I'm only a beginner with this language, so forgive me for any mistakes in language. I need a script to copy a file (which is in the same directory ...
3
votes
1answer
339 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
184 views

How to set colors in PSReadLine in PowerShell

PSReadLine in PowerShell has syntax coloring, but how do you specify the colors?
4
votes
0answers
362 views

Why doesn't windows command prompt still support ctrl + v? [closed]

This is just one of those things that I started wondering about. Why aren't the copy/paste keyboard shortcuts (that we all love) in command prompt not aligned with the rest of the software ...
0
votes
1answer
230 views

Powershell Script to Return Directories Without a Zip File Created/Modified Within the Last 7 Days

I have a series of folders on a server that needs to be regularly checked that they are being backed up correctly. We like to have at least 1 backup in that folder that is no less than 7 days old. The ...
2
votes
1answer
180 views

Why does ForEach-Object behave differently when called as foreach?

In PowerShell, foreach and % are default aliases to ForEach-Object. However, it seems the command behaves differently depending upon how it is called. Particularly, I have a hard time getting the ...
1
vote
1answer
221 views

Run a script with an interactive prompt on login

I am trying to run a script in Windows Server 2012 on login. I used the group policy editor to assign a .ps1 powershell script which runs fine. However it does not get assigned a command prompt. I ...
10
votes
3answers
253 views

Equivalent of cmd's “where” in powershell

I can't seem to find anything about a Powershell equivalent of the where command from cmd. Should I just call it from cmd or is there something more elegant in PS?
0
votes
0answers
35 views

Close openfiles in local pc

We want to close all open connections of a specified directory. But it shouldn't affect to other open connections. We used net files and openfiles commands. These commands works fine for shared ...