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

Comparing two specific properties of a CSV using Compare-Object isn't giving the expected results

I have a list of users from two separate domains. These lists are in CSV format and I only care about the SAMAccountName, which is a field in these CSVs. The code that I'm working with is currently: $domain1 = Import-CSV…
MDMarra
  • 100,734
  • 32
  • 197
  • 329
2
votes
0 answers

Powershell and sharepoint and updatelistitems() exception

I've got an issue where I keep getting "Exception calling "UpdateListItems" with "2" argument(s): "Exception of type 'Microsoft.SharePoint.SoapServer.SoapServerException' was thrown." whenever I call $service.updatelistitems($listname, $xml). …
BenConrad
  • 23
  • 4
2
votes
2 answers

Exchange - get age range of items using Powershell

We are going to be implementing personal archives for Exchange in our organization. For us to get a good grasp on how much space is needed, we need to get an idea of the age of items that we currently have. Is it possible to have a powershell…
marcwenger
  • 235
  • 1
  • 6
  • 21
2
votes
1 answer

Powershell Script to help archive company email

I am attempting to use powershell to gather emails that pertain to a certain subject, so that these correspondences might be turned over to a legal department. I am having a couple of issues here that I would like some assistance getting past. I run…
sec_goat
  • 169
  • 1
  • 1
  • 13
2
votes
1 answer

How to get cluster information remotely via Powershell?

I've been trying to find a good way to gather various pieces of a windows cluster setup remotely, preferably via WMI, as we are not yet at a point where Powershell remoting is implemented (and I know this problem goes away with that). I know I can…
FilamentUnities
  • 161
  • 1
  • 1
  • 5
2
votes
1 answer

IIS Application Request Routing(Monitoring and management) Powershell

I am working with iis arr powershell... In my iis i have one web farm and in that i have two servers "server1" & "server2"...... My task is Make server1 unavailable gracefully restart server1 iis make available server1... Make server2 unavailable…
2
votes
1 answer

How do I get a list of all iPhone users who use Activesync

It appears that IOS6 users have an issue with meetings that are randomly being cancelled and one fix may be to not ask users to upgrade. How do I get a list of affected IOS users (not android or anything else), and tell them not to update to the…
makerofthings7
  • 8,911
  • 34
  • 121
  • 197
2
votes
4 answers

Get OS architecture remotely via PowerShell

Does anybody know how to grab OS architecture remotely from multiple Windows hosts via PowerShell?
Volodymyr Molodets
  • 2,424
  • 9
  • 36
  • 52
2
votes
2 answers

A Powershell script which runs on a list of computer accounts and sets the security -> permission : "Allowed to authenticate"

As the topic says I'd like to automate the process of running on all computer accounts in my domain and setting this option to enabled otherwise people are unable to log into the servers using RDP. Any idea if it can be done using a script? The…
Itai Ganot
  • 10,644
  • 29
  • 93
  • 146
2
votes
1 answer

Obtain device driver version and associated GUID using PowerShell?

Right now, I am getting two separate objects A Win32_NetworkAdapter WMI object A Win32_PnpSignedDriver WMI object In my previous scripts, I've made sure I was calling separate objects, and relating them by the GUID $mydev = Get-WmiObject…
EGr
  • 609
  • 4
  • 14
  • 29
2
votes
2 answers

New-MoveRequest - How to assign -TargetDatabase dynamically

I am in progress to migrate (approximately) 5000 mail-objects and I need a way /script /command that will allow me to utilize the New-MoveRequest CMD-Let in combination with the possibility to dynamically assign the TargetDatabase. Any thoughts…
Andor
  • 152
  • 2
  • 8
2
votes
1 answer

Powershell: Call one remote script from another remote script

I inherited some code where one script references another like this: #Script1.ps1 param($arg1) # do some stuff # call script2 with argument from script1 .\script2.ps1 $arg1 #script2.ps1 param($arg1) # do some stuff unique to this script This…
user364825
  • 121
  • 1
  • 2
  • 7
2
votes
1 answer

How to dump certificate file from installer via command-line?

I'm building a script that will download and install a bunch of programs. One of those programs depends on a virtual driver, which needs its certificate to be imported in order to function. Normally, the installer does this for you in the GUI and…
2
votes
1 answer

New-ActiveSyncMailboxPolicy "not implemented" on Exchange 2007 SP3

If I try to run: New-ActiveSyncMailboxPolicy Test directly in the Powershell, it asks me if im sure, and if so, it does what it should. But if I try the same from my example Code in C#, then I get an error, saying that "the current host does not…
Flo
  • 31
  • 4
2
votes
1 answer

Powershell (sqlps) lastbackupdate not changing despite having run a sqlserver backup

I'm using Powershell to check last backup times across all our sqlserver databases. This seems to work really well, but I've got a question If I run this (a cut-down version of the actual script): dir SQLSERVER:\SQL\Server1\default\databases |…
mattypenny
  • 23
  • 3