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

Missing DomainControllers in Active Directory Object

We are setting up a new network environment that will have two domain controllers and ran into an issue with Windows not recognizing the existing domain controllers (DC-01 and DC-02) as Domain Controllers. Both machines are listed in the Active…
2
votes
1 answer

Get-Cluster cmdlet fails when using -Name param

Summary When I call Get-Cluster powershell returns the name of my cluster. For simplicity sake, lets call it Cluster1. If I call Get-Cluster -Name Cluster1 it fails with an error. Error: Get-Cluster : Check the spelling of the cluster name.…
Colyn1337
  • 2,397
  • 2
  • 23
  • 40
2
votes
1 answer

Running Get-MessageTrackingLog as a job in Powershell

I'm trying to create an Exchange 2010 script that will search each transport server as a job. I try the following: $transportserver = get-transportserver foreach ($ts in $transportserver) { $ts_name = $ts.name $s = New-PSSession…
smwk
  • 570
  • 2
  • 5
  • 14
2
votes
2 answers

Powershell execution policy within SQL Server

Can anyone help? Firstly I apologise if this is the wrong forum and for the amount of text you have to read. I'm not allowed to post images yet and a picture is worth a thousand words..... When starting powershell from SQLSMS 2008R2 and SQL2012…
user247460
  • 21
  • 1
  • 2
2
votes
0 answers

How can I force dnscmd.exe to provide its output in English?

How can I force dnscmd.exe to provide its output in English? I have automation that parses the output of various dnscmd commands, such as dnscmd /info > dnsInfo.txt. I'm using PowerShell to execute those dnscmd commands, and I have no direct…
scottwed
  • 21
  • 3
2
votes
1 answer

Need to format power shell output

I am pretty new to powershell and have been trying various ways to split the results from the following powershell script I found but have had no luck. At the moment the script list everything in 4 columns with no gap in between the results of each…
MJT
  • 93
  • 1
  • 5
2
votes
2 answers

Find last run defrag WMI or Reg key

I am trying to discover if there has been a defrag run on our servers. To save myself going to each one and loading the defrag program and checking the "Last Run" column I thought WMI might have this info. I have been checking the Win32_Volume…
user35213
2
votes
4 answers

24 hour expiration of first password

EDIT** I'm thinking of running a scheduled task at the end of every workday to retrieve all accounts who have never logged on and disabling their accounts. Please excuse any syntax errors. I may very well be fumbling here. Can anyone say if this…
Jacksgrin
  • 23
  • 1
  • 5
2
votes
2 answers

Errors when attempting to update source files, Server 2012R2 (errors 80073701 and 14081)

I have a Windows Server 2012R2 machine that I installed with Server Core, and then decided that I wanted to switch to GUI. I'll make the long story short: I ran windows updates, and now the source files are older/out of sync with the operating…
jeremy
  • 855
  • 4
  • 20
  • 31
2
votes
3 answers

Powershell - Set-ClusteredScheduledTask - Error "Incorrect function."

I'm experimenting with Powershell to add a ClusteredScheduledTask on a clustered server (Win 2012/R2) Technet sample code gives error: #canned exampled from http://technet.microsoft.com/en-us/library/jj649815.aspx $Action01 =…
NealWalters
  • 1,333
  • 8
  • 19
  • 39
2
votes
2 answers

How to invoke a commandlet remotely with powershell

How can I invoke a remote command with powershell. Both computers are in the same network and I can have a Remote desktop connection from one to another. EDIT: Both machine have Powershell V2, Windows Server 2008. The task I try to accomplish is to…
Eugeniu Torica
  • 217
  • 2
  • 8
2
votes
1 answer

How to start a runbook using web service call to SC Orchestrator in Powershell?

I have System Center Orchestrator 2012 R2 and I want to start a Runbook on the runbook server by calling the web service. The orchestrator console works fine if I browse to it like so: http://orchestratorserver.my.domain:82 When I first browse to it…
Mark Allison
  • 2,188
  • 7
  • 26
  • 45
2
votes
1 answer

Force active directory replication after joining a server to a domain?

I'm trying to create more 'self-service' virtual machines for the developers to use. On of the requirements is after running a script to bootstrap the machine and join it to the domain, that the machine's local domain controller immediately…
2
votes
1 answer

Powershell command providing incomplete list

This PS command is only returning 10 out of 12 groups that the user is member of. Anyone know why that will be? Get-ADUser -Identity username -Properties memberOf | Select -ExpandProperty memberOf > C:\user.csv
JasonXray
  • 21
  • 1
2
votes
0 answers

Powershell Install-WindowsFeature Application-Server (and subfeatures) and assign certificate

I want to use a Powershell script to install Application Server on a windows 2012 server. When using the wizard, it prompts for you to select a certificate (for WS-Atomic Transactions) from the local machine store (or generate a self-signed one, or…