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

9
votes
2answers
11k views

Programatically associate file extensions with application on Windows

I've just recently reinstalled Windows and in setting up my environment I've noticed that all my associations for the various programming languages I edit in Notepad++ have gone (naturally). I am ...
25
votes
5answers
10k views

Cannot change powershell default font to Lucida Console

This is a trivial problem, but it annoys me that I can't get to the bottom of it: I'm running Windows 8, Powershell version 3.0. By right-clicking on the title bar I can go into the Properties and ...
1
vote
2answers
81 views

Change Powershell Execution Policy silently from Batch script

I would like some help on setting a registry value for powershell. The path is [hkey_local_machine\system32\windows\microsoft\powershell\1\shellids\microsoft.powershell] ...
0
votes
0answers
37 views

Can't install local copy of MSI with msiexec, but can over the network with psexec

I'm not sure why this is the case, but I can't install a local copy of a MSI if I remote into the machine in PowerShell with msiexec. I get this error: [computername]: PS C:\temp> msiexec -q -i ...
0
votes
0answers
39 views

Is there a Powershell remoting equivalent of using psexec as the system account?

PSEXEC has a -s argument that will "Run the remote process in the System account." I'm currently using a Powershell remoting session as follows: $s = New-PSSession -computerName $server The user ...
0
votes
2answers
64 views

How to recursively delete all .DS_STORE files from a directory on a Windows Machine?

I extracted a .zip file compressed on a Mac and discovered that the compression included all the .DS_STORE meta-directory files (I think used to speed up spotlight search, but besides the point?). Is ...
0
votes
3answers
2k views

How to calculate the StartTime / UntilTime parameter using Get-Printer in Powershell?

I have an printer setup using the GUI and set the printer availabilty from 18:40 until 3:00 As well i got the PS command "Get-Printer Printer1 | format-list" The result of the command puts out: ...
0
votes
1answer
32 views

Parameters with spacebars parsed incorrectly for a powershell script run from a batch file

I have a batch file that runs a powershell script and I need to pass two parameters to the script. In my batch it looks like this: powershell -executionpolicy remotesigned -File "my script.ps1" "my ...
0
votes
0answers
59 views

PowerShell script is interrupted by a automatic reboot during unattend Windows installation

I have a problem during the unattended installation of Windows 7. I'm using an unattend.xml file to install Windows. In the unattend.xml, there are RunSynchronousCommand statements to run a PowerShell ...
1
vote
1answer
183 views

“invoke-command” using wusa.exe in powershell - won't install the msu

I'm attempting to push a windows hotfix to a number of computers on our network, using PowerShell v3. I've downloaded the appropriate .msu file, I've been able to successfully install it from the ...
1
vote
2answers
74 views

Copy all files with a certain name using Powershell

I'd like to find and copy all the files in a certain directory and all it's sub-directories with a particular name. I'm using Copy-Item in Powershell (technet | ss64) Here's what I have: Copy-Item ...
0
votes
1answer
178 views

Add line to text file after specific line with PowerShell

I have to edit remotely a file called nsclient.ini on hundreds of computers, the file contains some command definitions. For example: [/settings/external scripts/scripts] check_event="C:\Program ...
0
votes
1answer
79 views

Truncate a log file by datetime using Powershell 2.0

We have a simple log file. It gets too big or the entries irrelevant as they age. Entries have a datetime prefix similar to this: 01/22/15 01:54:17 -I- Start processing stuff Occasionally the ...
0
votes
0answers
11 views

How to control speed on Copy Paste [duplicate]

My situation is the speed of syncing files through vpn need to be controlled to 500K. I have couple of scripts running on schedule using powershell, robocopy. The process is basically just a copy and ...
-1
votes
4answers
53 views

Path error in script

I am Googling scripts to find a PS script to count file types and files in several directory's on our network. I have several directory's on my "Libraries" directory on my PC at work. I'm just ...
-1
votes
1answer
89 views

Set “deny log on locally” in Powershell?

Using powershell in Server 2008 R2, how to set the Deny Log On Locally policy for my domain?
0
votes
2answers
81 views

Replace files smaller than 1KB from backup

I need to use backups to replace corrupted files on a shared folder. All corrupted files are fixed size = 1KB and have the archive flag set. Basically, I'd like to replace files in the destination ...
1
vote
3answers
43 views

How do I permanently remove a default Powershell alias?

For some unknown reason, the devs included "curl" as an alias for Invoke-WebRequest, even though it is not compatible with the proper implementation of curl, which means it gets in the way when I try ...
-2
votes
2answers
142 views

Using PSexec to launch PowerShell session as system with specific window attributes

I'm trying to launch a PowerShell session via PSexec with alternate colors and some window attributes. The reason why I would need to run PowerShell through PSExec is so that I can have a ready-made ...
-1
votes
1answer
114 views

how to copy files from SFTP to local host(windows server) using powershell

I am using the below power shell command to copy file from server "SFTP" to windows server. for some reason the Script is not working would you please help # Scriptname.ps1 # send the files to ...
1
vote
1answer
49 views

Using atom as text editor for Github for Windows

small question, I use atom text editor, today I installed Github for windows. Since all my commits messages triggered notepad.exe, I used the following line to change my global editor: git config ...
0
votes
1answer
39 views

Powershell - select and update an attribute “on the fly”

I am trying to look for AD users who have an null attribute ("terminalservicesprofilepath") and to update this attribute in the same command. I can select the users, but how to update the attribute ...
2
votes
2answers
254 views

Is it possible to have App-distinct Color Scheme in ConEmu?

I am presently using Bash (with Cygwin), as well as Powershell, both using ConEmu. I'm using bash.exe and powershell.exe via tasks. I'd like to use different colour schemes for the different ...
0
votes
2answers
129 views

Find group of words in a text file and extract the line to new text file

my file ref.txt contains word "hi" "hello" "aloha" as per below: hi hello aloha And I have one more file abc.txt which contains many words including the above 3 words. Now I developed a ...
0
votes
1answer
150 views

Powershell Folder monitor/batch execution

I am new to Powershell. I have found a script that works with what I need, kind of. What I am looking for is a script to monitor a folder for specific file names/types. Depending on the file ...
3
votes
4answers
201 views

How to open a second PowerShell console window from start screen?

I pressed Win and typed in "PowerShell". However, since there's already a PS console window open, the computer switched the focus to it, instead of, as I intended, open a new one. How can I open a ...
0
votes
1answer
99 views

How to use Powershell command invoke-sqlcmd in batch script

I have a Powershell command that I want to be run in a batch script. It works well in the Powershell console, but I cannot call it properly in batch script. The Powershell command goes like this: ...
0
votes
0answers
73 views

How Can i Remotely Install .inf file for FLT Driver

I am using power shell to execute the install.bat on remote machine that install the filter driver. Prob: Script operations such as set registry key executes remotely but .inf file for driver ...
1
vote
4answers
316 views

Detect if powershell is running as administrator

How can I tell in my scripts if Powershell is running with administrator privileges? I need to know because I'm trying to run a program that requires the ability to open protected ports.
0
votes
1answer
177 views

Powershell - Copy-Item to a remote share path error illegal characters in path

OK, the real problem was that I was getting the path from a registry entry and then cleaning it with Regex. The very start of the path had a space in the front which I did not notice the way I was ...
2
votes
2answers
50 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?
1
vote
0answers
247 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
0answers
53 views

How to make a github commit be authored by “unknown”/“unrecognized author”?

For fun I'm trying to create an awful git command called "git shove" that basically does this: git add -A git commit -a -m "git shoved" git push --force I would like it also so that the author is ...
0
votes
1answer
51 views

Powershell No Logon Servers Available

I have one deployment server A, my local machine B and the server I'm accessing C. When I'm running a test script from B -> C it's successful. When I'm running that same script from A -> C it fails, I ...
1
vote
1answer
103 views

Powershell Window Tiny at High Resolution

I have recently bought a Lenovo Yoga 3 ultrabook which has a screen resolution of 3200 x 1800. My cmd window and Powershell window are tiny at this resolution. I have changed the size of the normal ...
0
votes
2answers
272 views

Shutdown/deallocate VM doesn't work in scheduled task

I created a scheduled task to shuwdown/deallocate itself (it's a VM on Azure) with Powershell. The PowerShell script is: Stop-AzureVM -Name "myvm" -ServiceName "myservice" -Force If the PowerShell ...
4
votes
2answers
15k views

Where is the known_hosts file for OpenSSH for Windows?

One of the servers I frequently log into via SSH has changed it's IP address. So, now I'm getting man in the middle attack warnings when I try to use SSH via Windows Powershell and OpenSSH for ...
0
votes
1answer
77 views

Is there a Window's Command Line Option to Show the Sizes of Directories

When I do a dir command it, gives this information: 02/11/2015 01:39 PM <DIR> bar 11/11/2014 07:22 AM <DIR> buz 02/12/2015 01:35 PM 140,660,736 foo.sdf ...
1
vote
0answers
41 views

Issues Adding Data to an XML Document w/PowerShell

Trying to add an element to an existing XML file using PowerShell. I have looked at several examples and my 'add' script works but, it is misplacing the element. Sample of XML I am using: ...
2
votes
1answer
8k views

How can I copy a file on a network share using a different login with powershell or batch file?

I have a file in a shared location that I want to copy over to my local hard drive. However I will not be running as a user that has access to the share. So I want to be able to authenticate under a ...
0
votes
1answer
146 views

In ConEmu / Cmder, how do you setup ConEmu Here to work with powershell?

I am trying to get the ConeEmu Here context menu item to work everywhere in windows explorer. Settings -> Integration -> ConEmu Here -> Command Currently I have: ...
0
votes
0answers
50 views

Reflect HKLM/SOFTWARE/Policies registry changes to HKCU/Software/MS/Win/CV/GPOs

Ok so I have a Local Group Policy (under Computer Config, not User Config) to force install extensions in Chrome. This policy needs to run for every user of the computer. The value is going to change ...
32
votes
5answers
45k views

Copy and paste in Windows PowerShell

How do I effectively copy and paste input and output in the Windows PowerShell?
0
votes
0answers
38 views

Why does PowerShell give “Access Denied” for Get-Content on a directory?

By accident, I recently tried running Get-Content on a directory. I'd initially thought it was a file because it was named very similarly to a common file I'd expected to be in the location. So I was ...
0
votes
0answers
41 views

Windows PowerShell - SqlServerCmdletSnapin100 Error

I am trying to run the following command through my winodws powershell: Add-PSSnapin SqlServerCmdletSnapin100 But I get the following error: How can I install SqlServerCmdletSnapin100? I can't ...
0
votes
1answer
40 views

How to filter this output from powershell?

This is my powershell command: powershell -noprofile -NonInteractive -Command "(gwmi win32_process | select ProcessID,ParentProcessID,@{e={$_.GetOwner().User}}, CommandLine) | ft -AutoSize" When I ...
4
votes
3answers
133 views

Windows Powershell doesn't seem to accept target paths with spaces

I was following this thread Is there a Win7 shortcut to position mouse in center of primary screen? Following the suggestion of the guy with 12 upvotes, I created a shortcut with the target file ...
0
votes
1answer
105 views

How can I get full command and parent process id from powershell?

It is the command I run in powershell gwmi win32_process |select ProcessID,ParentProcessID,CommandLine,@{e={$_.GetOwner().User}} And here is partial listing of the ouput ...
0
votes
1answer
91 views

GnuWin32 / sed unexpected behavior in Powershell

I am using GnuWin32 tools on Windows Command Line/Powershell. What is see: 11:15 enlil D:\Users\x> Get-ChildItem .gitconfig | sed "s/ */ /g" D i r e c t o r y : D : \ U s e r s \ x M o d ...
1
vote
1answer
932 views

Get song duration from an mp3 file in a script?

I am trying to list some of my mp3 files with Powershell. I have tried ls C:\test | Format-List -Property Name,Length which gives me Name : testfile.mp3 Length : 10058533 The length is the ...