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
1 answer

Convert Hyper-V .vhdx file for import into .vhd file for xenserver import?

A VM was sent to me as .vhdx instead of .vhd and I need to import it into xenserver which supports .vhd but not .vhdx. I looked at the following solutions: Convert-VHD via Powershell Hyper-V Converter The problem with using powershell, is you…
Damainman
  • 1,045
  • 5
  • 16
  • 26
2
votes
1 answer

How to get application for application event log

I have some servers that are commonly having error 1000s. I want to find if it's the same application all the time, or if it's different applications. I am using this: Get-EventLog application 1000 -entrytype error -newest 10 | select…
Joshua Nurczyk
  • 748
  • 6
  • 17
2
votes
3 answers

Unable to identify properties on item in powershell

In attempting to answer this question I came up against something that has bugged me for a while, and I have not been able to find an answer for. The following script block will list the names of all members of the local administrators group. $group…
Patrick
  • 1,280
  • 1
  • 15
  • 36
2
votes
1 answer

Powershell script runs in an infinite loop when executed a certain way

I'm using the Exec Powershell provider for Puppet to run some powershell scripts. I'm having an issue with the way it executes my script. The method of execution causes the script to run over, and over. I'm forced to kill the process myself, but the…
Geekman
  • 451
  • 1
  • 11
  • 21
2
votes
1 answer

How do I install Microsoft Exchange 2013 with Microsoft Powershell DSC?

We are working on a new build procedure. As a proof of concept, I wanted to install an Exchange 2013 server with CAS and Hub roles. I cannot find documentation on just how to do that. Has anyone tried this? I've seen examples for Windows Server…
Belmin Fernandez
  • 10,799
  • 27
  • 84
  • 148
2
votes
2 answers

vmware thin disk usage powercli

I want to ask a question about thin provisioning. get-vm commandlet can easly give us real space used by a vm totally. Assume that you have a virtual machine which has more than one thin disk. If we want to get more detail so as to calculate each…
2
votes
2 answers

Why is my WinPE 4 image growing and growing after every commit?

I am currently building a WinPE 4 ISO and I am wondering why the ISO file keeps growing after every commit and iso build. All i am changing is some lines of powershell code, which for sure are not as long as 1 MB. name: winpe4_v16.iso size:…
Matthias Güntert
  • 2,438
  • 12
  • 39
  • 59
2
votes
1 answer

How do I get Move Mailbox history?

The following command gives me partial detail on a mailbox move get-mailbox user@company.com | Get-MailboxStatistics -IncludeMoveHistory | ft DisplayName, MoveHistory However I'm interested in getting both the source and destination, and other move…
makerofthings7
  • 8,911
  • 34
  • 121
  • 197
2
votes
2 answers

Installing Powershell 3.0 or 4.0 on Windows 7 machines through Group Policy or SCCM

I am trying to update all of the Windows 7 machines that we have in one of our OUs in Active Directory with either Powershell 3.0 or 4.0. I would like to use either Group Policy or SCCM 2012 and would like it to be pushed as opposed to optional for…
Ian
  • 91
  • 1
  • 9
2
votes
4 answers

Looking for fastest way to sift through old files

We have multiple file servers where I work containing terabytes and terabytes worth of files. We have no system in place currently for archiving/deleting stale data. My task is to create a script that will move/delete files older than 3 years.…
Benjamin Hubbard
  • 173
  • 1
  • 1
  • 7
2
votes
1 answer

Change a DCOM application's identity with a script

I have a Powershell script to set up a WS2012 web server with no user interaction. The only thing I can't do in the script is to change the identity of a DCOM application. Or, more specifically, I cannot set the password of the user. I know it's a…
Armaggedon
  • 123
  • 1
  • 4
2
votes
4 answers

Windows client powershell reporting

I'm working on trying to find a way to get our windows machines to report to a webpage with information about it's MAC address, computer name, currently logged in user, and ip address. I wrote a powershell script and set it up as a scheduled task.…
Ian
  • 91
  • 1
  • 9
2
votes
1 answer

powershell Read-host does not stop for input

I thought this would be fairly basic, but i'm stuck. I have 3 lines of powershell script in which I want to collect a mailbox name from user input, then create names based on that mailbox name. (later the script proceeds to create the groups in AD,…
llirik42
  • 23
  • 1
  • 3
2
votes
2 answers

How to collect Security Event Logs for a single category via Powershell

I am trying to write a script which collects security log from all of our domain controllers hourly and stores them remotely; i can collect the security logs , but is there a way to collect the security logs by category or event number from the DC?…
2
votes
1 answer

How to export computers from Active Directory to XML using Powershell?

I am trying to create a powershell scripts for Remote Desktop Connection Manager using the active directory module. My first thought was get a list of computers in AD and parse them out into XML format similar to the OU structure that is in AD. I…
Cody White
  • 21
  • 2