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

Can I force powershell to ignore mouse input?

I'm running a basic Powershell script on a remote server, and while it's running, it ignores keyboard input completely. This is intended. When, however, you click anywhere in the Powershell window, it stops input until you clear the pause with a…
jski
  • 911
  • 1
  • 7
  • 20
2
votes
2 answers

Check management server on SCOM 2012

I have to check about 400 machines for the management server as we have moved from SCOM 2007 to 2012 and we need to check if the old SCOM 2007 server is still being pointed at. On an individual server I see the following: I'm checking this on…
daithi_dearg
  • 51
  • 2
  • 5
2
votes
2 answers

IIS 8: Setting the application pool username is ignored

I do this on IIS 7.5: Create an application pool, "testpool", and set the username and password to match one that exists in the AD. Then in powershell as administrator: Import-Module webadministration cd IIS:\AppPools Get-ItemProperty "testpool"…
2
votes
1 answer

How to Resolve Hyper-V Disk Location to Drive Letter

When viewing cluster disk properties in Failover Manager or the physical path to VHD's in the settings of a VM in Hyper-V Manager the location is displayed by GUID. Is there a quick way find out which GUID is mapped to which drive letter with…
2
votes
2 answers

Powershell script:Loop/Array not retrieving all AD Get Commands information: error "cannot bid parameter identity"

I have a powershell script that loops and retrieves AD information using get commands. At the moment it's retrieving the selected information for account name and distinguished name. But if I add another parameter/property e.g. members or full name…
2
votes
1 answer

How do I set "CustomAttribute6" for a regular AD user?

I'm trying to set AD attribute 6 in Powershell to update a user who has no mailbox, and isn't an exchange contact; and is only an AD user ObjectClass : user The command I'm using is: get-adobject -filter {mail -eq "danielk@company.com" } …
makerofthings7
  • 8,911
  • 34
  • 121
  • 197
2
votes
2 answers

It cannot determine the content type of the HTTP response from the destination computer wsman

I am trying to connect to an Exchange server via a wsman connection using PowerShell. The client server in question is in a Workgroup, while the Exchange server is in its own domain. I use the following command to try to connect to the…
user2996787
  • 21
  • 1
  • 1
  • 2
2
votes
1 answer

How to set RDS security layer in Windows Server 2008 R2 via PowerShell

I'm looking for a way to set security layer setting in Windows Server 2008 R2 RDS via PowerShell (other ways to do in programmatically will do also but PowerShell is preferable). Via GUI it can be set through RDP-Tcp properties on General tab (SSL,…
Mikhail
  • 1,295
  • 3
  • 19
  • 35
2
votes
1 answer

How to setup a daily report of the top e-mail senders in Exchange 2010

We have had issues with compromised Exchange accounts sending a large amount of unsolicited e-mails out. We have mitigated this by using a cloud e-mail gateway that does a better job in detecting these outgoing messages as to not hurt our e-mail…
Belmin Fernandez
  • 10,799
  • 27
  • 84
  • 148
2
votes
2 answers

How do I combine two Powershell outputs so that command #2 is run on each output?

I want to combine the commands Get-user and get-casmailbox so that I can get the "Company" from the first output, and the "ActiveSyncStatus" in the latter into a single output. I also understand that I could write an explicit loop do generate the…
makerofthings7
  • 8,911
  • 34
  • 121
  • 197
2
votes
1 answer

Execute ps1 script when CPU threshold is meet

I'm looking for a function similar to Debug Diagnostics Collector. Where you can setup a performance (or any counter) trigger (eg. above 50% CPU over 50 seconds). Once condition of a trigger are meet I would like to run a PS1 script. Has anyone…
Luke
  • 123
  • 4
2
votes
1 answer

Save Custom View from Event Viewer in .evtx

I have a Custom View in the Event Viewer with a couple of Event id's. I know you can save those event id's in an .evtx file to open it. This proces has to be executed manually. Now is my question, how can I automate this? Through a PowerShell script…
2
votes
2 answers

server 2012r2: Cannot add-pssnapin windows.serverbackup

I am trying to run powershell script for backups on Server 2012 R2. I Have installed Windows server Backup feature but when try to execute Add-PsSnapin Windows.ServerBackup  I am getting error PS C:\Users\administrator> add-pssnapin…
Alex
  • 23
  • 1
  • 4
2
votes
1 answer

How can I create a VPN connection inside windows image?

Just like we can add driver packages to a windows image file can one add a vpn connection preferably thru Add-VpnConnection inside a .wim file ?
Ayan Mullick
  • 486
  • 1
  • 6
  • 14
2
votes
1 answer

MailboxExportRequest ContentFilter is "Received -ne $null" when querying by date

I am trying to export a mailbox to a PST. All email that was received before yesterday is what I am trying to export. $y = ((get-date).addDays(-1)).ToShortDateString() $exportRequest = New-MailboxExportRequest -ContentFilter {(Received -lt $y)}…
Johnrad
  • 203
  • 2
  • 7