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
2answers
245 views

Understand difference between Oneget and Chocolatey, and Get Started using OneGet in Win10 RTM?

I am confused about Chocolatey, and OneGet. Does one currently just install chocolatey, and use it, if one is on Windows 10 Pro RTM, which supposedly shipped with OneGet cmdlets inside powershell ...
1
vote
1answer
134 views

More than one 'Open xxxxx here as Administrator'

I want the option to open a Command window or Powershell window as Administrator from the drive and directory context menus in Windows. I can have either by creating and populating the special ...
0
votes
0answers
43 views

PowerShell FunctionDefinitions

I have a requirement to create a PowerShell constrained endpoint and I am trying to include custom functions inside the pssc file. One such function is a wrapper to Restart-Computer that should take ...
1
vote
1answer
27 views

From within a virtual host how to know the virtual network type?

How would you determine the virtual network type (external or internal) from an hyper-v virtual host ? My goal is to activate DHCP for internal network and static ip for external network. Activating ...
0
votes
1answer
133 views

Open Explorer and Highlight Specific File with PowerShell

There are programs allows us to "View File in Explorer" on a file it opened or is listing (e.g. iTunes). Upon selecting that function, the file explorer is opened to the path containing that file and ...
0
votes
1answer
111 views

Run a scheduled task that can update the desktop background wallpaper without causing a foreground flash?

I like how certain Windows themes rotate through various images, but I also like to use BgInfo to write out various machine info to the desktop wallpaper image. I created a customized BGI file and ...
1
vote
2answers
1k views

Proxy configuration in powershell

I'm trying to install chocolatey on an windows behind a proxy: @powershell -ExecutionPolicy unrestricted In power shell I'm executing $wc=new-object net.webclient; $wc.Proxy=new-object ...
1
vote
1answer
32 views

Windows command line, autocompleting paths

In a PowerShell console I use tab key for autocompleting paths. Is there some possibility to make shell append '\' char to the autocompleted path? (Like in linux, autocompleting goes with '/' there)
0
votes
1answer
79 views

How do I get items from Exchange Server using Powershell with Outlook?

I'm using Powershell manage my emails in Outlook : # Connect $Outlook = New-Object -ComObject Outlook.Application # Select the "TDD" subfolder from my mailbox $EmailsInFolder = ...
0
votes
2answers
54 views

Is there any way I can use the “!” key instead of “F8” key in Powershell?

I am new to Powershell and I am trying to find if I can use ! instead of F8 to scan back through command history and return command that match the text on the command line. I am using Surface Pro ...
2
votes
1answer
141 views

PowerShell 5.0 Get-Help -ShowWindow doesn't display detailed parameters description

In PowerShell 3.0 and 4.0 when running: Get-Help Get-Service -ShowWindow it displays new window with full description of GetService command (with detailed parameters description). When running the ...
1
vote
1answer
35 views

Where does outlook get data for 'Mileage' Field

Currently I am creating a Powershell script to send emails although I need to send through a value in the 'Mileage' field. The email sends fine, although I cannot work out how to add data for the ...
1
vote
1answer
36 views

7zip : Set archive's LastWriteTime as old as the content

On windows, with 7za.exe v9.38, how can I set the archive's LastWriteTime (or CreationTime) same as the content? For example : I have a "toto.txt" file, created and last written on 01/01/15. 7za.exe ...
0
votes
1answer
103 views

PowerShell environment

I am proficient in bash and having trouble understanding the environment in PowerShell. Is there any way equivalent to /usr/bin for adding executables to the environment? How is the environment ...
0
votes
1answer
46 views

What it means when PM(K) of ps gets negative values?

I got the following negative PM (The amount of pageable memory that the process is using, in kilobytes) values when execute the ps command. What it means when the values are negative? PS H:\> ps ...
0
votes
1answer
54 views

Sensitive info in Powershell and/or cmd invocations

I want to run commands from Powershell and/or cmd.exe on a Windows host. These commands might accept, as parameters, passwords which should not be saved anywhere. These scripts may need to run from ...
0
votes
2answers
51 views

Change windows settings via code

I there any way I can use C++ or batch programming to change settings in a windows computer for example enable/disable Services? Or is there a different programming language for that? Which one is ...
2
votes
0answers
52 views

How to programmatically change permissions on computer objects in Active Directory

I've inherited control of an OU within an enterprise Active Directory domain. All of the computer objects in our OU are owned (and only writeable by) my predecessor. This prevents me from re-adding ...
0
votes
1answer
42 views

Pass argument to subprocess of powershell, that is itself a flag

start-process npm -verb runas -args @("install", "-g", "coffee-script") Is this the most straightforward way to pass arguments to a subprocess? It seems quite verbose!
1
vote
0answers
32 views

Remote PowerShell, which machine is making the incoming connection?

I'm trying to identify the connecting machine within a remote PowerShell session. The reason is so a script can behave differently depending on which machine is connecting. Get-PSSession doesn't ...
1
vote
1answer
178 views

PowerShell: Automatic Join-Domain with Secure String - 'Encryption Key' Usage

I work in an enterprise environment, where I manage a lab of 75 computers. I use Ghost to image and then I walk the computers afterwards to change the PC names and SIDs. I am implementing a script ...
1
vote
2answers
325 views

What's the powershell equivalent to “%~dpn0” in batch?

I'm new to powershell and I asked myself how could I put the following variables in a powershell script? I know how to set a variable in powershell, but I don't know how to get "%~dpn0". set pgm=%~n0 ...
1
vote
2answers
191 views

Opaque text but transparent background for Powershell/Command Prompt? [duplicate]

I would like to just have the text and header bar visible while I'm using the command line. I've tried Console, but like Powershell, adjusting transparency settings affects the text as well. Is there ...
1
vote
1answer
80 views

Restarting all core processes in Windows

Is there any way to restart all core/user processes and free-up unused and cached memory thereby simulating a Reboot except that it is way faster and easier. I know the way to -Simulate a Reboot to ...
0
votes
2answers
124 views

Remove all volumes from all connected disks - Diskpart

How can I remove all volumes from the hard drives in a WinPE environment using Diskpart through Powershell or WMIC calls? The WinPE image will be injected with the required packages using DISM ...
1
vote
2answers
158 views

Mapped Drive inaccessible from Windows Scheduled task

I am working with python 2.7.9 (64 bit) and windows server 2012 R2 I am trying to set up a windows scheduled task to run a lengthy python script every day. I've managed to by calling the python from ...
0
votes
2answers
63 views

Get IpAddresses of hyper-v linux machines

I have Hyper-v on windows server 2012, and in the Hyper-v I have CentOS 6/7 vm. I doing the following command: Get-vm -name "x" | select -ExpandProperty NetworkAdapters output: Name ...
0
votes
0answers
82 views

How do I supress the vmware tools reboot when doing an unattended installation?

I'm setting up a VMware machine factory using packer for my own development. I'm trying to install the VMware guest tools in the middle of this, but every time I try, the system reboots. The factory ...
1
vote
1answer
110 views

redirecting output in powershell produces UTF-8 encoded text

If I do echo zzz > test.txt and then open test.txt what I see is this: ÿþz z z Maybe it's not UTF-8 encoded - maybe it's UTF-16 idk. But sometimes it's just desirable to be able to output ...
0
votes
1answer
245 views

How to use Task Scheduler to open an elevated Powershell window and run SFC and DISM in Windows 10

I have a scheduled Task where an Admin Command Prompt opens up and runs SFC and DISM. Here are the actions I entered in the "Action" tab of Task Scheduler: Program/script: %windir%\system32\cmd.exe ...
2
votes
1answer
70 views

Trick for opening Powershell at open directory?

If you type "cmd" into the address bar of a window it opens the command line at that directory. Is there a way to do this same with powershell, thus saving you navigating to some deep recess of your ...
4
votes
1answer
324 views

How do I make Github's Git Shell appear in Windows 10 search?

I'm trying to get the Git Shell (from GitHub) to appear as a search result in the Windows 10 search bar. It shows up under "All Apps" and I can even pin it to the menu, but it won't appear in search. ...
0
votes
0answers
80 views

Microsoft Diagnostic Tool via C# remotely

I need an efficient way to execute the Microsoft Diagnostic Tool Troubleshooting Pack via C# on a remote machine. The criteria for the Troubleshooter is: Run elevated (admin). Run silent. Run ...
0
votes
0answers
103 views

File share and their size - Powershell script

So I have gotten a little further, I can now scan a folder if I type it in but scripts aren't for manual labor. I want to be able to use the command below to pull the share automatically for me. ...
2
votes
2answers
86 views

Differentiating between internal HDDs and external HDDs in Windows

In Windows, is there a command/function/cmdlet which I can call to help me differentiate between an internal (fixed) HDD and an external (portable) USB HDD? PowerShell commands, such as Get-Volume, ...
1
vote
1answer
56 views

Grouping files by parts of filename and copy these

I'm trying to find a way to group files together for easy copying. The requirement is that I have filenames like: aa0048.pdf and fg345_aa0048_somethingsomething.xml. There are 25000 files in the ...
0
votes
0answers
54 views

SETX not working when run as service

I have a service which invokes a batch file which runs a Powershell script which calls SETX to update an environment variable. The environment variable gets changed, but the change apparently isn't ...
0
votes
0answers
101 views

Powershell code to remove old ActiveSync devices

My PS skills are limited and need a hand. When I run GET-ACTIVESYNCDEVICESTATISTICS -MAILBOX (USER) | FORMAT-LIST IDENTITY,DEVICEID,LASTSUCCESSSYNC I get the expected output on the run. My issue ...
0
votes
1answer
47 views

Get-CimInstance not working when run from Scheduled Task

I have a Powershell script that exports a list of all the services on my local computer using the following command: Get-CimInstance win32_service | Export-Csv $PSScriptRoot\Local\services.csv It ...
0
votes
0answers
589 views

Powershell Copy-Item: Container cannot be copied onto existing leaf item

I have a Powershell script with a line that looks like this: Copy-Item \\[machine 1]\[path 1]\[directory 1]\ \\[machine 2]\[path 2]\ -recurse When my script gets to this line, the following error ...
1
vote
1answer
34 views

Windows shows more space used, than actually is

When I check the size of a directory via properties in windows 7 it shows 8,12 GBs are used. Since I am unable to locate those gigabytes in the subdirectories I checked with the powershell which shows ...
1
vote
2answers
33 views

Powershell on Windows 7 Machines

I'm having trouble seeing if there are any CmdLets available in Windows 7 that will allow me to add a printer remotely in PowerShell. I know Windows 8 and up has this capability but I can't find ...
0
votes
1answer
84 views

Print a list of all fonts used in all documents in a directory

Suppose you have a directory which contains (perhaps in sub-directories) Word 2000 (.doc) files. Now I want to analyze which fonts are actually used by a specific user. So, how can I scan this ...
1
vote
1answer
147 views

Powershell script to be called by serveral servers to copy log files to remote location

We have several servers that save log files locally and I'm trying to automate logging to a single network location with a name of the parent folder where log files are stored and date modified time ...
2
votes
1answer
265 views

Can't (re)install Git for Windows after issue with previous install

TL;DR: How can I completely remove ALL remains of a (probably) broken Windows Git install so I can start fresh? Looks like something from the previous install is preventing a new one. The "Program ...
0
votes
2answers
72 views

Find and replace capture group inside file

I'm trying to read a text file, doesn't matter what language ... $x = [IO.File]::ReadAllText("__init__.py") ... find a string $pattern = [regex] '(?s)(?:ExportSTL.+?global_scale = ...
1
vote
2answers
47 views

Powershell seems to store multiple presses of the enter key

I was working on a PowerShell script to add users to Active Directory from a csv file by generating usernames from their first and last names. After making an initial username (first initial + last ...
1
vote
1answer
77 views

How can I shrink the width of my columns in powershell on Windows 10?

I use a number of cmdlets that display data in a table of 4-5 columns by default. Some of this data was frequently larger than the default column width and got truncated, but that was okay because ...
0
votes
1answer
66 views

screenbright win7 powershell/commandline alternative

Work computer, so I cannot install any thirdparty apps :( Does anyone have the command line samples that work like screenbright? 2 monitors, one is darker than other and OS will brighten/darken ...
1
vote
2answers
241 views

Cmder PowerShell ignores profiles

I have some aliases set in Current User, Current Host and Current User, All Hosts. Starting PowerShell (i.e. outside of Cmder) loads those profiles and so aliases are available. Starting PowerShell ...