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

Manage client workstations with Remote Powershell via SSL

I am looking for a solution to remotely manage around 100 workstations. I will be connecting to these systems to complete several local system tasks. (3rd party updates, security auditing, incident response) Remote Powershell over SSL seems…
tcshain
  • 31
  • 1
2
votes
2 answers

Running powershell commands ruined the users

The computer where the script is executing is in the one domain, I'll call it internal domain. Users which are tested are in the other (external) domain. I made a script to check if user exist in both domains. Here is a snippet from the script which…
Vladimir
  • 153
  • 1
  • 8
2
votes
2 answers

How can I get the number of users actively using Lync?

How can I report on the number of users actively using Lync in my organisation? I want to be able to find out what the uptake is. Thought about going through our mail server, but the saved conversations don't go via SMTP. Also wondered if there's a…
Ben
  • 1,137
  • 9
  • 26
  • 44
2
votes
2 answers

Can a Windows Server CA separate code-signing keys from keys for other purposes?

I am a software developer. My team encrypts the sensitive sections of our ASP.NET web.config files. aspnet_regiis.exe is used to manage the local key store, encrypt and decrypt. I want to build a quick key-manager tool to avoid remembering its…
2
votes
0 answers

Exchange (2013) Powershell Connection Error

I am using Windows 2008 R2 with Exchange 2013 I am trying to connect to my exchange server with the following command but receive an error each time: $session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri…
user2104891
  • 135
  • 2
  • 12
2
votes
3 answers

Powershell-move disabled computers to OU

This prints disabled computer accounts to the screen. I want to run a conditional statement against the results and, if true, move them to my "disabled" OU. get-adcomputer -ldapfilter…
user179037
  • 77
  • 1
  • 3
  • 7
2
votes
2 answers

Exchange 2010 Powershell: Deleting a Mail Contact associated with a user

Good morning! I have a quick question. How would I delete the mail contact associated with a certain user? This is what I have tried: Get-Mailbox 'jsmith' | select ForwardingAddress | Remove-MailContact This throws a command piping error: The…
Neil
  • 842
  • 7
  • 13
2
votes
1 answer

Powershell - Select-object keeping same columns throughout script

OK. I'm just drawing a blank here or I'm missing something obvious. In a Powershell (V3) script, I'm calling Get-ADUser -Filter 'SAMAccoutnName -like $ADUserName' -Properties Name,SamAccountName,EmailAddress | Select-Object Name, SamAccountName,…
Jason
  • 21
  • 2
2
votes
2 answers

Schtasks -- what is wrong with the following command

The following script schedules successfully but will not actually, you know, restart the server. schtasks /create /tn "restart test" /ru "domain\admin" /rp supersecret /sc once /st 11:35 /tr "PowerShell -command {Restart-Computer -ComputerName…
Kernel Panic
  • 291
  • 2
  • 8
  • 19
2
votes
3 answers

Add user account to local Administrator group on multiple Windows Server 2008 machines

I have a number of servers to which I need to grant administrative access to 1 particular user, i.e. add him to local admins. I guess it can be scripted with PowerShell or somehow else.. Can somebody advice me how to do it?
Mikhail
  • 1,295
  • 3
  • 19
  • 35
2
votes
3 answers

Can you use Powershell Remotely to reset AD passwords for Server 2008

Young intern here with a powershell project. My goal is to use a domain computer with administrative [domain] rights to reset user passwords in AD from our server. In order to do so, I have installed Vmware and, to my extent, setup a VM Server 2008…
Bob
  • 73
  • 6
2
votes
3 answers

'exit status' of a powershell pipeline

How do I check for the success/failure of a pipeline from within the same executing script? Get-VM -Name Machine | Get-Snapshot | Where {$_.Created -lt (Get-Date).AddDays(-1)} | Remove-Snapshot -Confirm:$false I don't need anything more than the…
Yolo Perdiem
  • 626
  • 1
  • 6
  • 14
2
votes
1 answer

Cannot Create InboxRule on one individual mailbox

This one user when trying to create a rule through outlook throws the generic "One or more rules cannot be uploaded to Microsoft Exchange and have been deactivated. This could be because some of the parameters are not supported, or there is…
Ryan
  • 21
  • 1
2
votes
1 answer

Microsoft Exchange Management console, Initilization Failed

Upon starting Exchange Management Console I am presented with the error [###################] Connecting to remote server failed with the following error message : The WinRM client sent a request to an HTTP server and got a response saying the…
skukx
  • 143
  • 4
2
votes
2 answers

Windows PowerShell can not find modules

I'm very new to PowerShell and have not administered Windows in a while. I have downloaded the Windows Update PowerShell module zip (http://gallery.technet.microsoft.com/scriptcenter/2d191bcd-3308-4edd-9de2-88dff796b0bc) and put it in…
linuxadmin
  • 51
  • 1
  • 1
  • 3