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

Connect to powershell through SSH with keyexchange?

I have little experience with Windows systems. Coming from a Linux background I was wondering if there is a way that I can ssh to powershell from a Linux shell? If this is not possible, is there a key exchange like way to connect from powershell to…
Lucas Kauffman
  • 16,880
  • 9
  • 58
  • 93
2
votes
1 answer

Why does this PowerShell script hang?

Today I had to use Start-Sleep many times so I thought I would create a shortcut function for it, sleep($time). However, whenever I entered the function it never exits! It must be an issue with either the data type for the argument for Start-Sleep…
tacos_tacos_tacos
  • 3,250
  • 18
  • 63
  • 100
2
votes
0 answers

Can you use SQLite 64 bit odbc from powershell

I have installed 64 bit ODBC driver for SQLite, downloaded from this page. I am running PowerShell version 2 on Windows 7. In the ODBC configuration I create a system DSN with name LoveBoat, pointing to a valid file. I don't have any "real" apps…
2
votes
2 answers

Powershell or WMI to pull Printer Properties and Additional Drivers?

What I am trying to accomplish: Use a powershell script (WMI or cmdlets directly, or a combination) to query a 2003 or 2008 server with the PrintServer role, enumerate the printers shared, then list the drivers in use for that printer and…
JeremiahJohnson
  • 100
  • 1
  • 7
2
votes
1 answer

Export from Saved system log

Using powershell, is there any way we can export system event logs from a saved system event log file (*.evt). Get-Eventlog does not recognize the "-logname "Saved system log"". Any ideas ?
whizkid
  • 355
  • 1
  • 4
  • 16
2
votes
2 answers

OutVariable is broken for Exchange 2010 cmdlets

It seems that OutVariable is broken when using the Exchange 2010 cmdlets. Is it just my server or is this the case for everyone? I observed the following -- get-mailbox jdoe -OutVariable asdf | out-null $asdf.getType() You cannot call a method on…
pk.
  • 6,451
  • 2
  • 42
  • 63
2
votes
1 answer

Powershell: Wanting Exchange statistics and running into (output) limitations

I am trying to gather mailbox statistics for all mailboxes in our organization, exporting it to an Excel /CSV file. This is the code I came up with /gathered so far: Get-Mailbox -ResultSize Unlimited |Get-MailboxStatistics | where {$_.ObjectClass…
Andor
  • 152
  • 2
  • 8
2
votes
1 answer

add certificate to all files in EFS-folder with script

I try to set up collective access to EFS-folder. I want to add certificates of all users to all files in folder. Is it posible do with using powershell scripts or some another way? Thanks.
2
votes
1 answer

Are there any good open source developer machine setup scripts for windows/c# development?

I've used thoughtbot's laptop setup script to setup my mac for ruby develpment in the past. Is there anything similar out there for windows/c# development? Something that sets up IIS, installs visual studio, etc. would be great.
Evan
  • 131
  • 3
2
votes
1 answer

Restore more than 250 files using DPM 2010 and PowerShell

I've got what should be a fairly simple task: restore the following files from DPM: D:\inetpub\wwwroot\*\index.* I followed the instructions in this TechNet wiki and pretty much thought I had it. Unfortunately, the New-SearchOption commandlet can…
toryan
  • 231
  • 3
  • 6
  • 17
2
votes
3 answers

Copy-Item not working as expected

I cant figure out what I am doing wrong with this command and would like another set of eyes to point it out. I want to copy the directory structure but not the files the structure contains. Copy-Item -recurse -exclude *.* -path…
Jake
  • 2,268
  • 5
  • 30
  • 40
2
votes
2 answers

Having difficulty getting multi-line Powershell regex to work - no matches

I referred to several examples I was able to search, which seemed highly pertinent, but am still unable to get this to work. My input looks like this, from a dhcp server stats command, and I've confirmed that $output is getting defined properly with…
Kevin
  • 21
  • 1
  • 1
  • 2
2
votes
2 answers

How do I grep text in remoting mode

In powershell (2.0) the following works nice and fine: cmd /c echo "hello" | select-string hello Outputs "hello". When running this in remoting mode, text is not printed: Invoke-Command -ComputerName myserver -Credential user.name@domain.tld { cmd…
2
votes
1 answer

Programmatically retrieve Application Pool Defaults

Using the IIS namespace, one can query the IIS Apppool settings, using: $pools = get-wmiobject -namespace "root/microsoftiisv2" -query 'select * from IIsApplicationPoolSetting' However, this only returns information about the existing application…
glasnt
  • 637
  • 2
  • 6
  • 21
2
votes
1 answer

RD Gateway reporting features/capabilities

We have just implemented RD Gateway for our own department in preparation for a push to the whole agency for telecommuting. It is all setup and working great, but I was trying to figure out how best to go about monitoring/reporting of users. I see…
Don
  • 838
  • 8
  • 19
  • 33
1 2 3
99
100