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
82 views

Why dont the chocolatey install instructions work?

So I am trying really hard to follow the instructions given for chocolatey install, but they don't work. From their site, they say "Its so easy to install!", and to "just open a power shell" and ...
1
vote
1answer
137 views

Exchange 2010 - Open Other User Mailbox Permissions Issue

I just started working for this small firm (30 people) a little bit ago, replacing their System Admin. First thing I noticed was Exchange Server 2010 was WAY out of date. Believe it or not they did ...
2
votes
1answer
40 views

PowerShell - Changing the PipelineVariable name

In PowerShell you can change the name of the variable used as the item in an iterative block, such as: dir -recurse *.snippet -OutVariable snippets $snippets | Where-Object -PipelineVariable fn { ...
0
votes
1answer
57 views

Replace files with symlink

This question is intended to be the inverse of Replace Symbolic Links with Files, but for windows. I have started running out of space on my SSD drive, and I found that about 12% of used space is in ...
0
votes
0answers
435 views

Powershell script to add user to active directory and set static IP

I have seen other similar questions but I am looking to fully automate the process and all of the examples I have found up until now are missing pieces that I need. Also, this is the first poweshell ...
3
votes
2answers
664 views

PowerShell ps1 scripts open in Notepad by default, not in PowerShell ISE. Why's that? [closed]

I regularly have to spin up VMs, and then I have to switch the .ps1 and .psm1 file association from Notepad to the PowerShell ISE. Does anyone know why it's not the default editor to begin with? It ...
-1
votes
2answers
65 views

PowerShell - working with multiple decimal points (i.e driver versions)

I'm trying to make a script to update machines that are using old drivers. I can get the devices I want to target like this:Get-WmiObject win32_pnpsigneddriver |where {$_.DeviceID -match ...
1
vote
1answer
109 views

Remote Registry with alternate credentials from the command line

Sometimes, when I'm teleworking from my personal laptop, I run into problems with my SmartCard reader while trying to connect to systems that are configured to enforce SmartCard usage. The usual ...
0
votes
0answers
266 views

Powershell - Test user credentials in AD, with password reset

I can successfully use Powershell to tell if a user authenticates in Active Directory: Function Test-ADAuthentication { param($username,$password) (new-object directoryservices.directoryentry ...
2
votes
1answer
124 views

Powershell LastWriteTime is incorrect

I am running the following script to create directories based on the first 9 characters in the filenames in the directory and then moving te files into these directories based on their filenames. dir ...
1
vote
0answers
102 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 ...
0
votes
1answer
70 views

Is rm reversible?

On a Windows Server 2012R2 environment, is the PowerShell cmdlet rm undoable? The TechNet manual for Remove-Item states that it deletes an item (multiple types), but no specification about the ...
0
votes
1answer
76 views

Regexp based editing of content in large CSV files [duplicate]

I wanted to remove certain pattern of contents based on a regex from csv file which is very large in size containing 100,000+ records, how is it possible via windows commandline? I also have sed and ...
1
vote
1answer
45 views

ScriptBrowser for Powershell won't run

I'm trying to run ScriptBrowser for Powershell, but it won't run for me when I click on the shortcut (nothing happens). I tried right clicking on the shortcut to see what it is running, but instead of ...
1
vote
0answers
212 views

Get-Command missing in Powershell after installing Version 4

Something must have gone wrong by installing dot net framework 4.5 and Powershell 4.0 I tried repair install of framework 4.5 and even deinstallation and reinstallation, but it doesn't help. PS ...
0
votes
2answers
206 views

Create Loopback and assign local addresses on Windows 8

I'm usually on OSX where I often add additional IP addresses to lo0 interface to simplify ssh tunnelling to various services on different machines to different local addresses: # Tunnel mysql ...
1
vote
3answers
109 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
249 views

How to Launch an App in an Existing Session

When a scheduled task runs I would like to open a Powershell window on my desktop to tail the log file and watch the progress. Specifically I would like the task to open the window on my desktop and ...
2
votes
3answers
2k views

Find AD users with specific AD attribute NOT null

I'm looking for a script/Powershell command that will list all AD users that have a value not NULL in the teletexterminalidentifier attribute, so they must have a value set. By default this attribute ...
0
votes
1answer
270 views

Windows 2012 Domain Controller NETLOGON error

We have Sonicwall firewall user authentication System active since last two months. We have Windows 2012 Active directory server setup with around 1400 user account created. These accounts were ...
0
votes
1answer
85 views

PowerShell “.count” method causing incorrect processing

I am creating an array in PowerShell that doesn’t always contain data (sometimes it is empty). I need to verify that the array contains data before trying to do anything to the array objects. When I ...
1
vote
1answer
121 views

Appx package does not show in Start screen

Recently, I decided I want to grab some applications that were originally shipping with Windows 8 and sideload them to Windows 8.1. So I just installed Windows 8 in a virtual machine and then grabbed ...
2
votes
1answer
61 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 ...
1
vote
1answer
42 views

Copy a list of folder to another folder?

Is there anyway so I can copy a list of folders within a text file to another folder in Windows? I have a text like this: 87312 87313 87314 87315 ... I assume it's possible via Powershell.
0
votes
2answers
76 views

move-item or copy-item then remove-item

I have a list of files that I want to move from one folder to another location and retain the folder structure in the new location for example I have the following files 1.txt 2.txt 3.txt located as ...
1
vote
0answers
83 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 ...
1
vote
2answers
178 views

PowerShell create VHD

I would like to create a VHD (virtual disk). I know this can be done with diskpart create vdisk file C:\w7.vhd maximum 10 However I am trying to do it with PowerShell. I found the New-VHD Cmdlet, ...
1
vote
1answer
150 views

Is there anyway to see when a Windows firewall rule was created/enabled using PowerShell v2 or CMD?

I have been poking around the interwebs but I cannot seem to find a definitive answer to this question. I am forced to work with PowerShell v2. I know that using the following command will give me a ...
0
votes
2answers
111 views

Powershell - Uninstalling a List of Programs Taking Too Long

I am looking for assistance on making a bit of code more efficient. I currently have a simple Powershell script (part of a larger script) that enumerates items from a text file (namely the string used ...
2
votes
1answer
66 views

Use PowerShell to interpret registry values

Consider the following key, as an example HKEY_CLASSES_ROOT\txtfile\shell\open\command and its (Default) value %SystemRoot%\system32\NOTEPAD.EXE %1 This value determines what will happen when ...
2
votes
2answers
92 views

How can I display utf8 in powershell?

So this really has me knocking my head against the wall. I have some XML: <trans-unit id="4" translate="yes" xml:space="preserve"> <source xml:lang="en-US">Customize Forecast ...
2
votes
1answer
727 views

Get computername by username

I am trying to find a computername that is used by certain user. To do it I get a list of computers by Get-ADComputer and then ask all of them if there is a user I am looking for logged on. This is ...
2
votes
0answers
90 views

Get-ChildItem | tree gives me a wierdly formatted tree

Edit: This is the value of $OutputEncoding: IsSingleByte : True BodyName : iso-8859-1 EncodingName : Western European (Windows) HeaderName : Windows-1252 WebName : ...
0
votes
0answers
120 views

Write a small script to extract ms-exchange audit logs in csv format?

Background I'm using ms-exchange 2013 in my environment, and have a separate siem box which analyze logs produced by different systems (i.e exchange). The logs for exchange are internally stored and ...
0
votes
1answer
1k views

Remove column header from sql query output in powershell

I want to remove column header from sql server query output. I did the search but not found any solution. I have a script. $Database = "temp" $Server = "localhost" $AttachmentPath = "output.csv" # ...
0
votes
1answer
132 views

Error while deploying unity web player application on Parse.com

I have created a game using unity game engine and build it using unity web player.After building i got two files client.html and client.unity3d . Now I am try to deploy these on Parse.com . Initially ...
4
votes
1answer
75 views

Recursive folder rename through command line

I have 500000 plus files in over 3000 directories and need to rename all folders called PHOTOS to Photos. I also need to Rename any Folders call Photos blah blah blah to be called just Photos. It ...
0
votes
1answer
139 views

Windows Explorer Does Not Include Hidden Files' Size When Calculating Folder Size

It seems Windows Explorer does not include the sizes of "hidden" files when calculating the parent folder size, even when I check "Show hidden files, folders, and drives" in the "Folder and Search ...
0
votes
1answer
66 views

How do you export Windows 7 AQS search to file? [duplicate]

My question is identical to this question that has already been asked back in 2011, but that does not have any answers: Export Windows 7 Advanced Search Results to Text File I'm hoping that someone ...
2
votes
1answer
2k 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 ...
1
vote
0answers
29 views

How to create many directories with access control by using powershell 2.0

I am trying to learn the win2008 r2 In the win2008 r2, i create many student users . So i need to create the independent directory for storage file (Read ,write,execute). In dc C:\place\ i create ...
0
votes
0answers
66 views

Read the COM1 output of a Hyper-V guest system

I have a guest O/S that writes debug output to the COM1 UART. This port is virtualized by the Hyper-V host. The Hyper-V Server allows only a redirection to a "named pipe". I want to read what the ...
4
votes
1answer
1k 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 ...
6
votes
3answers
5k views

Delete all Files from Folder and Sub Folders

I'm wanting 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 VBS scripting? I have tried a very basic batch command but ...
0
votes
1answer
55 views

Get-ChildItem Returns No Files Through Remoting but Works Correctly When Logged In Interactively on Remote System

I have just started working with the remoting features of PowerShell 3.0. My current problem is that I can log in to remote machine "secondmachine" and execute the command gci ...
0
votes
1answer
209 views

PowerShell Create new Active Directory user with password as secure string

Having some trouble creating a command to create a new user in powerShell, the code I'm using is: PS C:\Users\Nicky> New-ADUser -Name johnd -GivenName John -Surname Doe -DisplayName John Doe ...
0
votes
0answers
41 views

Best way to deploy Powershell 4.0 on Windows 7 sp1 and server 2008

I am planning to deploy powershell 4.0 on all Win 7 and server 2008 and 2008R2. I did some research about this, but couldn't find the official way to do it. I can just use batch file or GPO to ...
1
vote
1answer
139 views

Need to create a robocopy in Powershell 1.0

My ultimate goal is to mirror a folder and its subdirectories with the restriction of only copying files with the extensions, sln, vcxproj, cs, cpp, hpp, c, and h. There are far too many subfolders ...
1
vote
1answer
608 views

How to set location to a mapped network drive in PowerShell?

I'm trying to set location to mapped network drive Z in PowerShell and it's not working. I have the following drive letters: C, D, E, Z. Where the first three are just local disks, and the Z is of ...
2
votes
1answer
187 views

Get CPU for process in powershell

I want to get the value that is shown in task manager for any process in the CPU column in powershell. I tried using Get-Process ProcessName | Select-Object -Property CPU but it only returns the ...