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

Powershell Array search for keys

I Have an array called $a echo $a gives: url load --- ---- …
Joel
  • 237
  • 2
  • 12
2
votes
1 answer

How do I find the mailbox name for an exchange 2010 account so I can connect using mapi

I was redirected here from Stack Overflow, so my apologies if this happens to be off topic. I have an issue at the moment where I am trying to set up a connection between my exchange account and a program I am using with mapi, and I cannot find the…
Johnnerz
  • 23
  • 1
  • 3
2
votes
0 answers

How to retrieve a MDT task sequence variable and use it properly inside Powershell

I'm trying to retrieve a MDT task sequence variable inside a Powershell script, then use that variable in a Powershell function. My problem lies in that the variable I want to retrieve contains a Powershell-variable that will not resolve properly.…
rogergh
  • 31
  • 1
  • 2
2
votes
1 answer

How do I take an eml file and place it in the inbox for journaling, without sending the email?

I have an archiving system that reads both envelope and legacy journaling messages in an Exchange 2010 environment. The journaling target is simply a mailbox that receives a copy of every SMTP message, and there is a 3rd party application that…
makerofthings7
  • 8,911
  • 34
  • 121
  • 197
2
votes
1 answer

Can not install Office 2010 via winrm

I am trying to install Microsoft Office 2010, I have created a MSP and config.xml file so I can do this from Powershell, using the following command: Start-Process "C:\temp\Office2010\x86\setup.exe" -ArgumentList "/config `"Config.xml`" /adminfile…
SmudgerDan
  • 141
  • 4
2
votes
2 answers

How can I speed up PowerShell cmdlets that are using the -CimSession parameter?

As the title says, how could someone speed up the execution of this tiny script? Am I using the New-CimSession that right way anyway? $computers = Get-ADComputer -SearchBase "OU=W2012,OU=Servers,DC=contoso,DC=com" -Filter * foreach ($computer in…
Matthias Güntert
  • 2,438
  • 12
  • 39
  • 59
2
votes
4 answers

How to find a directory disk usage over network? (Windows)

I have an external disk that is connected to a LAN network. I want to find the disk usage of a directory on the disk from a script. I looked at power shell and SysInternals tools but couldn't find any solution. Any ideas? Thanks.
2
votes
1 answer

How to interactively change the password of a user account on a remote windows machine (in the same LAN) from a local machine's command line prompt?

Suppose there is a user account named testuser on a windows machine and it belongs to the Users group and the Users group only. The current password of testuser is known. The question is, how to change the password of testuser in a command line…
2
votes
1 answer

Import Module from newer Powershell Version

I was asking myself if I could import PowerShell modules from a newer Windows version. The *-NetAdapter CMDLets in Windows 8 and 8.1 are quite nice, so I wanted to use 'em in Windows 7 too. Unfortunately they need PowerShell 4.0. I managed to…
2
votes
1 answer

How can a user in Exchange 2013 access public folders in Exchange 2007?

In my environment, there is an Exhange 2007 server and an Exchange 2013 server. I have a few public folders in Exchange 2007 server. I want to know how a user in Exchange 2013 can access the public folders in Exchange 2007. I've searched for it a…
2
votes
2 answers

Reporting SCEP update and scan

I am using Microsoft System Center Endpoint Protection on all of the workstations I manage. For all three major platforms, it is a pain to get it to report on when it was last updated and last scanned. By parsing the system logs, I was able to…
Jason Bray
  • 131
  • 1
  • 6
2
votes
1 answer

Find Full or Differential backup from .bak (with powershell or by any other means)

I'm trying to determine whether an MS SQL backup file (.bak) is Full or Differential. Is there an easy way to do this? A way of doing this in powershell?
2
votes
1 answer

How can I retrieve the device information?

From Windows Server 2012 R2, how can I retrieve a device's vendor name and model number without physically opening the machine? For instance, PCI cards. Get-WmiObject Win32_PNPEntity returns a bunch of information, including the manufacturer and…
slybloty
  • 443
  • 2
  • 9
  • 30
2
votes
1 answer

How do I invoke scanstate from the USMT for a large number of PCs?

I've already customized all of my XML files, but I'm having trouble figuring out the logistics of how to script scanstate to run on a large (~50) number of PCs remotely. I have a list of PCs and the corresponding user profiles I want migrated in CSV…
Bigbio2002
  • 2,823
  • 12
  • 35
  • 54
2
votes
3 answers

Powershell - Sort-Objects, list of IP Addresses

I've got a /20 network and I want to know all used IP Addresses and their attributes like the MAC, the name and the description plus all free addresses between the used ones so that I got a long list where I can see if the address is taken or not.…
mushr00mer1990
  • 351
  • 4
  • 14