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

Start Microsoft Edge maximized on first run

I'm developing an image for Windows 10 to deploy, and one of the requirements is that when Edge is started for the first time it should be maximized (not fullscreen, but maximized - the same result as ...
0
votes
1answer
44 views

How do you make an bat file that talks to a server?

Basically I have employees and I don't want them to know my powershell commands. So I would like to make my .BAT files into EXE files and everytime it is ran it will ask for a user name and password ...
0
votes
0answers
30 views

Windows PowerShell version 3.0 doesn't support installation of an exe

I am trying to install an exe using C# code (.net framework 4.5) and PowerShell script in remote machine. The remote machine's OS is Windows 7 and its PowerShell version is 3. The exe has been moved ...
0
votes
1answer
54 views

Determine 32bit/64bit from powershell script inside Inno Setup

Consider the following powershell script: [System.IntPtr]::Size [Environment]::Is64BitProcess If I run this directly inside powershell on a 64bit machine, then I correctly get 8 True But when I ...
2
votes
1answer
52 views

Does Powershell have any sort of .bashrc equivalent?

I have some functions I'd like to load by default when I open an administrative powershell. Is there any equivalent to say .bashrc or .profile that I could use to automatically import the scripts ...
3
votes
1answer
32 views

Is there a way to open regedit to the current path in powershell?

I'm using the Set-Location commandlet to move into the desired path in the registry. Is it possible to run regedit to that it opens in that path? Sort of like if you go into cmd, cd to the path you ...
-1
votes
1answer
48 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
63 views

Display Popup from script executed as System user

I've a scheduled task, executed by System user. It's can sometimes display a popup to interacts with the user. This work fine if I launch the script myself, but not displaying when launched by the ...
-1
votes
1answer
64 views

Renaming multiple files with same filename but different extensions

I have 180 files in a folder all with the SAME filename but 180 DIFFERENT extensions. I want them all to be .jpg. I cannot seem to make windows or dos or powershell work to rename all files to a ...
0
votes
2answers
84 views

Add Show/Hide hidden folders to Windows 7 context menu

Recently I've been bugged by the fact that it is so difficult to turn on "Show Hidden Files" in Windows as compared to other OS (ie. Ubuntu). I've been searching for a way to add an option to "Toggle ...
0
votes
2answers
50 views

powershell - simulate Windows-D to clear and restore screen

I have a request to get a screenshot of users desktop icons. I can use Powershell to capture, but need to clear the screen first, take the shot, then restore the screen. Keystrokes 'Windows+D" will ...
69
votes
11answers
55k views

Equivalent of Linux `touch` to create an empty file with PowerShell?

In PowerShell is there an equivalent of touch? For instance in Linux I can create a new empty file by invoking: touch filename On Windows this is pretty awkward -- usually I just open a new ...
1
vote
1answer
617 views

Why does FFmpeg append blank black video to the end of my MP4 files when compressed from MOV?

I have several large MOV files that I want to compress to MP4. Unfortunately, when I use FFmpeg, it appends lots of black (blank) video at the end. (The destination file is longer than the source ...
1
vote
2answers
11k views

Call PowerShell script from Excel macro

I'm trying to call a PowerShell script from a macro in Excel. I have seen a number of examples along the lines of: retval = Shell("powershell ""C:\MyTest.ps1""", 1) When I try to use this, ...
0
votes
1answer
28 views

Change powershell color return error

I was trying to change the CommandForgroundColor by command Set-PSReadlineOption -TokenKind Command -CommandForegroundColor DarkGray but I got return as: A parameter cannot be found that matches ...
0
votes
0answers
47 views

Powershell 5.0 SHA-3?

Does anyone know if it is possible to calculate SHA-3 in power shell 5.0 ? If it is not the case are there any open source 3rd party software i can use ?
0
votes
1answer
65 views

How to format a date field in powershell?

In this script, I can get the date for shortcuts, but is in YYYYMMDD (and time) format. I'm going for MM/dd/yyyy. I've tried several suggestions from the web, but all result in errors, maybe because ...
0
votes
0answers
20 views

Alert When Windows Task Scheduler Fails to Run [duplicate]

We have a script that is a security script, checking logs. Almost always it can be ignored and, for the most part, is; it sends out an email when it sees an issue in some logs of a particular type, ...
1
vote
1answer
45 views

Getting an error while creating multiple folders using `powershell` command-line

I am trying to create multiple folders using windows powershell by typing this into the command-line mkdir folder-one folder-one/sub-folder folder-two. However, I get the following error: C:\...
0
votes
1answer
464 views

Power Shell script to delete the User profiles from the windows server 2008 r2 to local machine(Windows 7)

I tried the following script on a Windows Server 2008 R2 to delete the User Profiles on a Windows 7 client machine. PS C:\> get-content localcomputer-list.txt | get-userprofile | where {$_.LastUse ...
1
vote
2answers
68 views

How to detect each Windows OS is used with powershell

I would like to check which version of windows is used in a remote machine, I'm using this command: $version=[Environment]::OSVersion.Version | % {"{0}.{1}.{2}" -f $_.Major,$_.Minor,$_.Build} I get ...
1
vote
1answer
23 views

Powershell becomes normal shell after running cmd

I want to use "start-ssh-agent.cmd" (is part of git for windows installation) from powershell. The problem is: if i run this in powershell my powershell becomes a normal shell. The prompt changes from ...
1
vote
1answer
2k views

Powershell script to run a .reg file on remote computers

I have tried creating a batch file using PsExec to update registry settings on remote computers without success so I am now trying to use Powershell. I have compiled the following script by using ...
0
votes
0answers
23 views

How can I run a powershell script such that it does not create a tab on the toolbar?

Most of the time I have a powershell script running while I work (its basically a local server). I never interact with it directly, its always a background task. Despite this, it still hogs space on ...
1
vote
0answers
65 views

Can't initialize VM's on HyperV Windows Server 2012

I'm really stuck with this and I can't understand why I sunddendly can't make ANY VM to start succesfully in my system. I had just one VM, and it was working perfectly, then for some reasons I booted ...
0
votes
0answers
39 views

Visual Studio newbie need help making a VB front end to a PS script

I'm a system admin at work and part of the day to day is creating new mailboxes for users in Office 365 and we are forced to use powershell to do this. The only variable in the PS commands is the user'...
1
vote
1answer
25 views

Exchange Powershell

trying to create script to delete exchange 2010 mailbox messages. creating input file in csv format with three headers. Recipients Subject Sender with these values: line1: user1@campus.edu,...
-1
votes
1answer
66 views

Windows 10 Provisioned Apps

I am trying to create a nice clean bloatware free Windows 10 image. I have used the following line in PS but it seems to remove a lot more than just rubbish apps, but even after running the command, ...
1
vote
0answers
10 views

Detect when a drive is plugged into a Hyper-V host and automatically attach it to a VM as a pass-through disk

I current am using a WS2012R2 file server and it is a VM. I already have a NAS storage for backing the data up on it and now I want to add a offsite USB storage drive as well... While it isnt much ...
0
votes
1answer
53 views

Powershell script to return all logged on users on domain

I have a powershell script that returns all of the users logged into all of the machines on the domain. For some reason, it works fine when ran as an individual line query session console /server:...
0
votes
0answers
32 views

How to monitor File History on Windows 8.1 / 10 remotely?

We are using File History feature in Windows 8.1 and 10 on the machines. It's been working well. Is there anyway from the administrator point of view (remotely) that can monitor this activity ...
0
votes
3answers
61 views

Powershell - filenames that match two (or more) patterns

To find files in a directory that have both "foo" and "bar" in the filename, we can use: Get-ChildItem | Where-Object {$_.Name -like "*foo*" -and $_.Name -like "*bar*"} Is there a more elegant way ...
1
vote
1answer
43 views

Using Powershell OUT-FILE changes data

Here is sample code that displays physical disk info on the console (with much thanks to guyc@computerperformance.co.uk): Get-WmiObject Win32_DiskDrive | % { $disk = $_ $partitions = "ASSOCIATORS ...
0
votes
0answers
25 views

Text pipe not working in powershell

As asked by someone else here: https://github.com/trentm/node-bunyan/issues/322... The command node somescript.js | bunyan (where somescript.js writes utf8 text to stdout and bunyan consumes stdin) ...
1
vote
2answers
134 views

Run a Windows application without displaying its GUI

Is there a way to run a Windows application without displaying its GUI window? I have a 3rd party Windows application which does not have any command line parameter or switch to suppress its GUI. I ...
0
votes
1answer
54 views

run powershell command from cmd

how i can run this command from cmd : powershell.exe "(get-process | ? {$_.Description -eq "Sysinter Process Explorer"}) | select processname | out-file $env:APPDATA\example.txt" i still get ...
5
votes
4answers
55k views

How I can upgrade PowerShell on Windows Server 2008 R2?

I am using Windows PowerShell 1.0 in Windows Server 2008 R2. I have tried PowerShell 3.0 in Windows 8 and it looks good to me. Now the question is: How I can upgrade PowerShell on the Windows Server ...
0
votes
1answer
43 views

How to equivalent to ps -ef in Windows 10

I have looked online, and have not found anything that would accomplish what I want to do. I am looking for a command with output equivalent to "ps -ef" of Linux so I can find out the process id ...
0
votes
1answer
16 views

Clear Application Event Log by Source

I've seen various sources suggesting something like this to clear all event logs: wevtutil el | Foreach-Object {Write-Host "Clearing $_"; wevtutil cl "$_"} But what I would like to do is remove ...
0
votes
0answers
32 views

Close process gracefully that has no window

So, I have a script that starts some auto-hotkey scripts while also starting up a game. I want those scripts to close again when the game ends. Currently I'm doing this with the kill command. This ...
0
votes
0answers
50 views

Uncheck IPv6 Checkbox (Unbind) for a Specific Network Adapter on Windows 7 with PowerShell

To preface this, I'd just like to say I have spent a great many days considering the great evils of this request. Nevertheless, I must press on. Unfortunately, on Windows 7, the NetAdapter module is ...
0
votes
0answers
54 views

Powershell : this command sticks my script, freezes

I am trying to get a list of available updates using $UpdateSession = New-Object -ComObject 'Microsoft.Update.Session' Write-Host "[1]" $UpdateSession.ClientApplicationID = 'MSDN PowerShell Sample' ...
0
votes
1answer
1k views

Remove cached credentials for MS Onedrive using a script

I have a need to be able to remove onedrive cached credentials from local machines from the windows credential manager using a script The reason - When a user is prompted to change their O365 password ...
0
votes
0answers
65 views

Windows 10 search is broken

Since I ever started using windows, my go to method to open pretty much anything is to press the windows key and type whatever I am trying to find/open. However, since last week my windows search just ...
0
votes
1answer
75 views

kill process by its own description

I need help for killing putty.exe by searching process for it's description even if the user change the name and the class name ( win title ) for the putty.exe if process description on process list ...
1
vote
1answer
56 views

How to install every printer (with wildcard) from PrintServer

is there a quick and easy way to install every printer from a print server over a console like PowerShell? Add-Printer from PowerShell does not support Wildcards. I tried it with Get-Printer and ...
1
vote
1answer
48 views

How to know from what microsoft package/update a .dll file comes from?

There are plenty of specific missing X.dll requests here. I would like to know how to get where does a .dll file should come from, especially a microsoft .dll. I have a missing assembly error on my ...
62
votes
6answers
68k views

PowerShell equivalent of curl

Is there an equivalent of curl in PowerShell? Does it have some similar built-in capability or is there a 3rd party cmdlet?
1
vote
1answer
147 views

Find and delete duplicate root certificates

We are in a disconnected domain and have just implemented updated root certificates via group policy. I have found now though, that there are a number of duplicated root certificates in the users ...
0
votes
1answer
60 views

Script to get a list of users allowed to connect computer

I would like to inventory the users and groups that are allowed to connect to a computer (interactively or remotely). The computer can be either in a workgroup or in an active directory but primarily ...