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

0
votes
1answer
24 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
0answers
18 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
30 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
11 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
16 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
14 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 ...
0
votes
0answers
10 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
45 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
34 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
66 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
36 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
1answer
22 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
1answer
31 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
16 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
15 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
0answers
27 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 ...
1
vote
0answers
29 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 ...
1
vote
0answers
35 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
31 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
21 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
55 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
37 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
21 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
36 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
18 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
54 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
31 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
22 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
27 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
19 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 ...
0
votes
0answers
31 views

Batch file (or similar) to create multiple folders, named after a user input

I need to create a little application that will prompt the user for an input, (ie. John Smith) and then create a folder structure as follows - SMITH, John 1-AAAAAA 1-AAAAAA - ...
0
votes
0answers
14 views

Performance of -Filter vs. -Include

I need to search some large directories for certain file names/patterns. I've got a dozen or so specific names or wildcard strings I need to search for. What's going to be the best way, in terms of ...
1
vote
1answer
55 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
34 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
18 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
23 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
21 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
36 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 ...
2
votes
1answer
161 views

How to add Active Directory module in PowerShell in Windows 10?

I've installed Remote Server Administration Tools for Windows 10 Technical Preview (January 2015) but no dice. Anybody knows how to do this? Many thanks!
0
votes
0answers
23 views

How do I make Git Shell open Bash instead of PowerShell?

I have GitHub for Windows installed. In the options, I have selected Git Bash instead of PowerShell, and when I click on "Open in Git Shell" from within GitHub for Windows, it correctly opens Git ...
0
votes
0answers
17 views

Connect to Oracle database by powershell

It sound stupid but i want to know how we can connect to oracle database remotly by powershell. I know we can connect by using ODP.net but i am looking for all possible option. I dig a lot on google ...
1
vote
1answer
15 views

How can I collect `pslist` elapsed time information by using wmic?

The MS technet utility pslist can produce result like this: How can I use wmic to obtain the 'Elapsed Time' result? If it is not possible, I am happy to try Powershell.
0
votes
0answers
11 views

Uploading Arduino firmware automatically

I am on Windows 8.1. I have an Arduino Uno kit, that I program with the help of Arduino IDE. The IDE allows me to edit my files, compile them and burn them into the Arduino memory. However, I have ...
1
vote
0answers
20 views

Enumerate remote SMB shares with PowerShell on non-Windows system using WIndows 7

I need a way to enumerate the SMB shares of a remote, non-Windows system while using PowerShell on my Windows 7 system. The file server I'm checking is not running a Windows OS. However, I need to ...
-3
votes
0answers
43 views

Code to Reset Google Chrome Advanced Settings

I'm looking for a code which can reset Google Chrome's Advanced Settings. You can do it manually, by going to Settings > Show Advanced Settings > Reset Settings > Reset Instead, I want code that ...
0
votes
0answers
24 views

Starting a Program with Powershell Remoting

Using Windows Powershell, this opens notepad. notepad.exe But this, which is meant to remote into a virtual machine and open notepad there, does not. Instead, the process starts but the GUI is ...
0
votes
1answer
34 views

Detect application crash based on app user's name

been trying to create script to detect user's application crash. (Assume the computer is used by multiple users) so far only managed to come out below code to query the application (based on user ...
0
votes
1answer
76 views

Restoring Disabled Modern Apps?

So I ran the following in my PowerShell: Get-AppxPackage -AllUsers | Remove-AppxPackage This has made Windows 10 SOOOOOOOOOOOO much better. My question is, what if someday I want to restore some of ...
2
votes
1answer
141 views

How to set custom syntax coloring for PowerShell 5.0?

I recently upgraded a Windows 8.1 computer I had to Windows 10, which comes with PowerShell 5.0 by default. I noticed that PowerShell now has syntax coloring for keywords, cmdlets, strings, etc.: I ...
3
votes
0answers
46 views

Path too long, but it's not?

I'm trying to run a Get-ChildItem -Recurse against a file share and I'm getting some "path too long" errors. But when I dig into it, some of them aren't. I'm using -ErrorVariable to capture the error ...