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

3
votes
1answer
239 views

Updating the last write time for a symbolic link in Windows

Is it possible to update the last write time for a symbolic link in Windows? I can use the following powershell command to update the last write time of a directory, but it doesn't work for a ...
2
votes
1answer
108 views

Determine the Size of a Network Folder

I want a PowerShell script to get the size of a network folder (\\pmintl.net\rbsdata\SPA_BB01) approximately 100TB in size with lots of subfolders. I've tried various scripts without any luck (below ...
2
votes
1answer
1k views

Get Network Printers From A Remote Computer

I am using this to attempt to get a list of printers on a remote computer: Get-WmiObject win32_printer -ComputerName "$oldPcName" The problem is I only get local printers, not those printers from ...
2
votes
1answer
167 views

How to remove substring in Powershell script

This script is almost what I need: $input_path = 'C:\Common' $output_file = 'C:\Common\extracted.txt' $regex = 'assets' Get-ChildItem -Path $input_path -Filter *.txt | Select-String -Pattern $regex ...
2
votes
1answer
116 views

How to change date format in multiple text files in powershell?

Hello I have around 5000 text files (TXT) in one directory.Files are comma delimited. What I'm trying to do is to change date format (it is stored in first column of each file) from M/d/yyyy to ...
2
votes
1answer
645 views

batch script to “scan for hardware” in Windows 8.1

There is this issue with Wifi on the Surface Pro 3 that can be easily fixed with a script that does the equivalent of running "Scan for hardware changes" in the Device Manager. This script will be ...
2
votes
1answer
79 views

“Help Tree” returns help for Copy-Item

In doing some research on another question, I wanted to check to be sure that tree was not an actual native PowerShell command or alias. Of course, the proper way to do this is with Get-Command. ...
2
votes
1answer
62 views

What is the powershell equivalent for `pwd -P`?

I have made a symlink using cmd /c mklink /D "MyDir" C:\MyDir in my home directory C:\Users\myusername. When I type cd toDir from my homedir and type pwd it returns Path ---- C:\Users\myusername\My ...
2
votes
1answer
812 views

Troubles running Azure powershell

I'm trying to install Azure Powershell, following the instructions on this page. The installation seems to run fine and proceeds without errors. However, once it's finished, I can't manage to find ...
2
votes
1answer
572 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 ...
2
votes
1answer
201 views

GIT via OpenSSH in Powershell is fine, so why can't I connect in plain cmd console?

when I run ssh user@servername01 ...under powershell it connects without a problem, however when I run the same command under a standard cmd prompt I am prompted for a password (no password is set ...
2
votes
1answer
206 views

Powershell - Elevation Loses Current Directory

One problem leads to another! User help just fixed one issue, which led to another as I continued working on this script. My script runs a check to see if the current user is an Administrator as ...
2
votes
1answer
105 views

Powershell commands for modifying files if accessed times is within a time window

I'm trying to learn Windows powershell and in particular, would like to write a script to operate on all files within a folder (including subdirectories). The script will examine each file and if the ...
2
votes
1answer
478 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 ...
2
votes
1answer
522 views

How to lock Powershell ISE console output scroll?

I'm using Powershell ISE for running some batch scripts. The outputs will be long and these programs will run for quite a some time. The problem I'm facing is I'm unable to lock the console output to ...
2
votes
1answer
1k views

Task scheduler doesn't work unless I run it manually

I have a scheduled task on my Windows 2008 R2 server which is supposed to run a powershell script to download a backup of a file from another server. On this same server, I have scheduled the exact ...
2
votes
1answer
503 views

Version 1 powershell, get-childitem to look only in a listed directory, not all subfolders

I have v1 of powershell on my servers. It would be easy if I had a newer version of PowerShell but that is not an option for me at this point. I have a script that looks to see if a file in a ...
2
votes
1answer
520 views

How to enable CredSSP

I am trying to use the -Authentication CredSSP switch when entering with PowerShell (2.0) in order to remotely launch a Script that can write to files or set up new PSDrives. I get an error when I ...
2
votes
1answer
2k views

PowerShell Remoting using CredSSP is broken

I recently had PowerShell working perfectly with CredSSP, but now every time I try to establish a remoting session using CredSSP, I'm getting the following error: Enter-PSSession : Connecting to ...
2
votes
1answer
345 views

How to disable iritating beeping sound in powershell

sometimes I run grep (aka select-string) that has string that occurs too ofter, then powershell goes crazy, sometimes I manage to kill it with ctrl-c, but even then i have to endure irritating beeping ...
2
votes
1answer
466 views

Powershell - find file names within a string when their names are unknown - only their extension is known “.jpg”?

Using PowerShell, how can I get a list of file names within a string, if I only know the extension? Simplified example: C:\> $e = "CN=Ken Myer world.jpg more text." C:\> $f = ...
2
votes
1answer
380 views

Using SQLConnection object in powershell

I want to use the SQLConnection object as I would from vb, for example. I'd like to do this: e.g. $conn = New-Object system.data.sqlclient.sqlconnectionstringbuilder $conn.DataSource = 'myserver' ...
2
votes
1answer
276 views

Git, Powershell, %HOME% and multiple repos

I'm going to start off by saying that I'm not particularly good with either git or Windows. However, I've been successfully using msysgit on Windows 7 for a while now, keeping track of a number of ...
2
votes
1answer
580 views

Running logon scripts with the standard user access token?

I have a powershell script which executes after I logon to my account. This is done by a group policy logon script. Because I am in the Administrator group this script is run with elevated rights ...
2
votes
1answer
2k views

Can't start PowerShell as administrator

I have Windows 7, and I want to run PowerShell as an administrator. I found it in the Start Menu, right clicked it and selected Run as administrator, but I get the following: Windows Explorer has ...
2
votes
1answer
1k views

Set paper size of Zebra TLP 2844 programmatically

I have a lot of Zebra TLP 2844 printers used by domain users. Unluckily by default the paper size is 2" x 4" while I need to have 4" x 3". The first time each user logs on I have to change manually ...
2
votes
1answer
1k views

powershell import-csv mangles diacritical characters

I am trying to create users in AD (2003 server R2) from a CSVfile using PowerShell (v2) when I use import-csv the resulting data gets mangled when names have diacritical characters in them. Jerónimo ...
1
vote
1answer
29 views

Powershell ISE scrolls to the bottom of the console upon re-focus

With PowerShell ISE: If using a split view (showing both the console and script pane), re-focusing on the console from the script pane (or another console tab) will always scroll to the bottom. To ...
1
vote
1answer
48 views

getting 9th column of data from multiple files and dumping it all into new file

OK guys, I have 24 subfolders, named Angle1, Angle2, etc up to Angle24, each with a file called output.txt. Note that these folders have subfolders which I want to ignore. Is there a way to loop ...
1
vote
1answer
99 views

Windows-8 how do I write a script to change the resolution?

I have a yoga 2 pro that comes with a high resolution display (2k I believe). This sometimes causes issues with programs not scaling properly which for the most part I can ignore. However I also ...
1
vote
1answer
202 views

Need help writing a Powershell script to automate a silent install of Avamar Client on multiple machines

I am writing a Powershell script to automate a silent install of Avamar Client on multiple machines. Here is the script that I have written so far, but it keeps coming up with errors: #Variables ...
1
vote
1answer
120 views

Reuse of environment variables in Path

Is it possible to reuse environment variables in the Path environment variable from PowerShell? There are some environment variables like %SystemRoot% defined and are used in Path variable ...
1
vote
1answer
165 views

How to install a network printer on powershell?

I've been trying to install a network printer using Powershell on Windows 7 so that I can automate the setup of our development machines using Puppet. I found a couple of instructions around but none ...
1
vote
1answer
141 views

Zipping Sub-folders

I want to use 7-Zip to zip subfolders to another folder on the same drive. Each sub-folder has zillions of text files. I just want to zip subfolder as a whole via Powershell. I have a script but ...
1
vote
1answer
136 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 ...
1
vote
1answer
109 views

How do you change the default powershell font style?

I'm changing both Powershell and the Windows Command Prompt to use Ubuntu Mono has the default font. After installing the Ubuntu Mono Font Family and modifying the registry, both consoles pick up ...
1
vote
1answer
182 views

Windows Activation Powershell Script

I'm looking for a method to automate activation Windows 7 machines through PowerShell. We get approximately 50 computers a month and it's slowly increasing, so manual activation is no longer possible ...
1
vote
1answer
81 views

Download files from web, unknown name of file

I need to download 10-15 programas every week, and looking how to automate the process. It's easy when I know exactly the name of .exe file; but what about the case when I dont? For example, lets ...
1
vote
1answer
335 views

Powershell 2.0 Enter-PSSession cannot get New-PSDrive working

I have a remote computer which I can Enter-PSSession successfully. When I execute: New-PSDrive -Name "G" -PSProvider Filesystem -Root '\\fileserver\apps\etc' I get the following error: ...
1
vote
1answer
69 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 ...
1
vote
1answer
142 views

powershell foreach loop fails as it increments count by first test

I have been asked to monitor c:\temp on windows servers. I need to know how many folders are there and if they are there greater than 1, 2 and 3 minutes. This reporting works in a basic form but not ...
1
vote
1answer
117 views

Powershell is installed but winrm is not found

one of my servers is win 2003 and has powershell 2.0 installed, but I don't see winrm service there and can't thus run "Winrm quickconfig". It says "command not found". As a result, I can't call ...
1
vote
1answer
2k views

Powershell Script to SFTP New files

I have a script here that SFTP's files from one location to another, the script works fine however I'd like to change the script so that it only copies files that are not already present. Bit of a ...
1
vote
1answer
428 views

Can I query AD from a client computer in the domain using Powershell?

I have a DC (windows server 2008 r2) that I want to run some Powershell queries against AD. Powershell ISE is not installed on any of the DCs. Is it possible to install Powershell ISE locally on my ...
1
vote
1answer
64 views

How does one start the Powershell ISE with no file open?

When I launch powershell_ise.exe, it defaults to having an open file "Untitled.ps1". Is there a mechanism to ask ISE to launch showing only the prompt? That is, at the moment when I launch Powershell ...
1
vote
1answer
63 views

Configure WinRM to Use HTTPS makecert.exe Name Syntax

I am trying to enable the remote execution of powershell scripts on a remote server over https using this example. What I do not understand is what value to give for the hostname when generating the ...
1
vote
1answer
224 views

Given a list of KB numbers for Windows Updates, how can I find out what's in the updates?

I have this issue with a program I work on, where the program behaves differently on my development machine v. the QA environment. I suspect the difference between the environments lies in which ...
1
vote
1answer
103 views

How can I make cygwin commands a priority over built in windows commands?

If I run ls in powershell the windows built in ls function is run. how can I make cygwin ls run instead? I've tried moving cygwin/bin to top begin system path variable, but that didn't work. is ...
1
vote
1answer
126 views

I want to read a value from a text file and compare it with a number

I am using windows powershell. I want to retrieve a number which is stored in a text file and compare it with some other number using a shell script. If I use $x=$(cat value.txt) it says "command not ...
1
vote
1answer
51 views

Launch Script for Windows7

Hey guys hopefully I can thoroughly explain what I'm trying to do here! LOL I have a dual display Windows 7 PC and what I am trying to do is launch 2 different programs on boot, and I want one to ...