Questions tagged [powershell]

An interactive shell, scripting and programming language, and surrounding environment from Microsoft. Commonly used by system administrators managing Microsoft software (including Windows, Exchange, SharePoint, and cloud services Azure and Office 365), PowerShell is included by default with Windows, and takes over from previous languages such as VB Script.

PowerShell exists to create a more powerful shell than Command Prompt, a more capable language than VBScript, and an environment with built-in support for remote servers and code documentation. Since its introduction, Microsoft added support for PowerShell scripting to many of their core products.

This comment by Jeffrey Snover, one of the original designers of PowerShell, explains the ideas and intent behind the language, and why it was developed instead of porting something like Bash from a Unix environment.

PowerShell provides a vastly improved scripting environment for Windows compared to previous .bat and .vbs methods; it includes PowerShell ISE - an editor and debugging environment, on the language side it has easy support for using lists, hashtables and regular expressions for pattern matching, as an interactive shell it has tab completion for command parameters and interactive help via Get-Help, and it can natively work with COM objects, WMI, registry values, call out to any .Net Framework method or library, and create and use modules written in PowerShell code.

Microsoft Software that supports PowerShell for management includes: Windows Server (and many roles and features - Active Directory, IIS, DNS Server), Exchange Server, SQL Server, SharePoint Server, Windows Azure, and Office 365 components. Here is a full list of PowerShell modules included in Windows Server 2012 and Windows 8.1.

First released in 2006 as a downloadable addition to Windows XP and Server 2003, PowerShell has been significantly upgraded in 2009 (v2) with the addition of remote execution of scripts, and in 2012 (v3), 2014 (v4), and 2016 (v5). In 2018 Microsoft released PowerShell Core (v6) which was open sourced and runs cross-platform on Windows, Mac, and Linux.

4084 questions
2
votes
2 answers

Powershell runs all external commands in a new window, omitting output

As described in the subject, my powershell environment is executing all external commands in separate windows. In a typical test run of my team's build script, this includes things like: nuget.exe running for each project in a sln nunit test…
2
votes
1 answer

Windows 2008 Server R2 Command Prompt/Power Shell Slow Scrolling

I'm having an issue with various Windows 2008 Server R2 machines scrolling very slowly using the command line or Power Shell. For instance, if I type "dir", I see my contents being displayed 1 line at a time at about 1 second intervals. How can this…
2
votes
1 answer

how do i combine multiple powershell scripts in a guided install (for example with wix) but without the trail (ARP etc.)

I am working on a project where we need to repeat certain steps with powershell to deploy stuff. i would like to create a process/install guidance (steps supported with UI) with WIX but after the msi has finished i have an entry in programs and…
Didier Caron
  • 121
  • 1
2
votes
3 answers

How To List All Computers Operating System On A Network In Powershell

I am looking for a script to show all the machines, hostnames, and OS versions on my domain. I have found a few scripts, but none of the scripts that I have found will do both. Here is an example of one that I have found: $strCategory =…
nate
  • 417
  • 5
  • 8
  • 17
2
votes
1 answer

Powershell: Piping input to Set-Acl

have a messed up folder with inconsistent ACLs which I need to uniform. I hoped to accomplish this with powershell. So I'm trying to search for all files missing the required group and applying the rights threough Set-Acl: Get-Acl | where…
shkdd
  • 125
  • 1
  • 9
2
votes
1 answer

Can't shut down HyperV VM with Powershell despite admin rights

I am attempting to use a script that shuts down my Hyper-V VMs, copies their VHDs to a target share, then boots them back up. I found the script on spiceworks just a couple days ago. I always receive errors that the system name intended for shutdown…
Shrout1
  • 363
  • 2
  • 7
  • 18
2
votes
2 answers

Powershell ForEach-Object : Cannot bind parameter

I am trying to get the owner of a process using this code: (Get-WmiObject -class win32_process | where{$_.ProcessName -eq 'explorer.exe'}).getowner() | Foreach-Object user | out-string This works great under Windows 8 but in Windows 7 I get this…
user3460112
  • 21
  • 1
  • 2
2
votes
2 answers

powershell and using get-eventlog

I am trying to create a script that pulls failed log on attempts for certain events in the past 24 hours but I cant figure out how to pull the account information out. User is Null all the time so info is blank BUT when I look in the general tab I…
MJT
  • 93
  • 1
  • 5
2
votes
1 answer

Drainstopping NLB via powershell remotely

This question was asked by a colleague on SO here, though it was suggested that we ask it here instead - apologies for the cross posting. Server is Windows Server 2008 R2 - UAC is disabled on the server (temporarily for this testing only) - User is…
Terry_Brown
  • 121
  • 4
2
votes
2 answers

Powershell scan for network attached printers

Currently I'm working on creating a PS script to scan a network and retrieve all of the Windows Servers, their product keys, SQL Server product keys, CPU, RAM, Network Shares and Services on all the Windows servers found. Basically this is to…
Mike Naylor
  • 937
  • 1
  • 7
  • 15
2
votes
1 answer

Passing arguments to a Powershell Script using Nagios NRPE

Short powershell script for testing: $test = $args[0] echo "this works" echo "I transferred $test" exit 0 nsclient.ini settings: # If you want to fill this file with all avalible options run the following command: # nscp settings --generate…
JustAGuy
  • 639
  • 3
  • 23
  • 38
2
votes
2 answers

Delete an individual user profile from Office 365/Sharepoint Online MySite, using Powershell

I'm trying to work out a process that would allow my helpdesk to delete an individual user's profile from Office 365 sharepoint online using powershell. It's easy to connect to our Sharepoint Online URL and see the sites we…
Rob Moir
  • 31,884
  • 6
  • 58
  • 89
2
votes
3 answers

Virtual Machines List from PowerShell vs PowerShell ISE and PowerGUI

I am confused to why I have different information based on where I try to retrieve it from. I have 3 Windows 2012 servers (G0, G1, and G2) running Hyper-V. The following situation is captured from one server which I use to run scripts and control…
slybloty
  • 443
  • 2
  • 9
  • 30
2
votes
1 answer

PowerShell ftp get won't save on Windows Server

From a Windows Server 2012, using PoweShell, I connect to a remote device through ftp and run get to retrieve a file. The process goes through with no problems but the file doesn't get saved on to my local machine. The command returns Operation…
slybloty
  • 443
  • 2
  • 9
  • 30
2
votes
1 answer

Using powershell to disable services, fails with 'specified service does not exist'

I am trying to run the following powershell command to disable Superfetch on a Windows 8.1 machine. Powershell window is open as Administrator and I am logged in as administrator. Set-Service -name Superfetch -StartupType Disabled -Status…
Richthofen
  • 275
  • 1
  • 4
  • 8