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
0 answers

Deploying Server 2012 with DNS role using WDS and answer file

I want to deploy an image using WDS on Server 2012. I will be using an answer file for unattended installation with little touch as possible. My answer file works great but I can't get the auto-logon to work and the FirstLogonCommand to run. I added…
blugs
2
votes
2 answers

Powershell execute Queries using SQLPLUS

I have a RHEL server with Oracle 10G installed. I need to write a powershell script to query my database and get the output. I have imported Posh-SSH module and am able to connect to my RHEL server and execute commands using Invoke-SSHCommand…
2
votes
1 answer

Powershell DSC uses the incorrect certificate file for encryption where node names partially match?

I think there's a bug in the way that DSC chooses the certificate file that is used for credential encryption, such as with the Service resource and a PSCredential. The DSC configuration uses the wrong CertificateFile from the AllNodes collection…
Robin M
  • 453
  • 2
  • 8
  • 14
2
votes
1 answer

Powershell: Pass parameter by name toa com object function

How can I pass parameters to a com-object function by name rather than by position? Specifically, I've a com-object function (Word document com-object SaveAs2) and for example I want to pass values to the 2 first parameters and to the last parameter…
EliadTech
  • 1,240
  • 9
  • 14
2
votes
3 answers

Different group policies in one domain

I'm using powershell to display the password expiration of an account before I reset it at work. But the global GP from what I can see, is 180 days, and there are some employees who have 90 days set on their account. Where are these other policies…
Aaron
  • 121
  • 3
2
votes
1 answer

Allow Enter-PSSession to work from local systems account

I have a PowerShell script that creates a Windows PowerShell session (PSSession) on a remote server via Enter-PSSession, both servers are not connected to a DOMAIN. This script is called from a program that is running as a service under the local…
ADarkDivideGem
  • 137
  • 2
  • 6
2
votes
1 answer

Windows 2012 R2 RDS - can't change Connection Broker DNS round robin name via Powershell

I'm running into an issue when setting up a Windows 2012 R2 RDS Farm. I mistakenly set up my High Availability Connection Broker's DNS round robin name to something that didn't match my cert. I found a way to easily change the DNS name here:…
2
votes
3 answers

Powershell Start-process -Argument list not working

Start-Transcript c:\scripts\InstallUpdates.log -Append # -NoClobber $SourceMSUFiles = (get-content install-list.txt | where {$_ -like "*.msu"}) #Install MSU files foreach($file in $SourceMSUFiles) { $Argument= "$Files",' /quiet',' /norestart' …
Joel T
  • 59
  • 1
  • 2
  • 7
2
votes
1 answer

Windows Server 2012 RD Licensing Issuing Multiple Temp Licenses Per Machine

I have just setup a Windows Server 2012 RDS environment with Per Device CALs. Looking at RD Licensing Manager it is handing out multiple temp CALS per machine and multiple permanent CALS per machine. At this rate I will run out of licenses very…
John Wesley Gordon
  • 183
  • 1
  • 3
  • 10
2
votes
1 answer

FSRM powershell behavior

I'm working on a script I can push out to a few dozen Windows Server 2012/2012R2 servers to enable FSRM File Screens that will write an alert to the event log when they detect a particular filename being written to disk. $a = gwmi win32_logicaldisk…
BIT_Craig
  • 31
  • 4
2
votes
1 answer

Stop automatic reboot with gpedit shutdown script in Windows 2k8

I am search for a way to validate and maybe stop an automatic reboot under windows. E.g. automatic reboot is initialized by windows update. When adding a shutdown script with gpedit this script gets executed correctly but what can I do when those…
chbiel
  • 21
  • 3
2
votes
2 answers

Move-ADObject : The operation could not be performed because the object's parent is either uninstantiated or deleted

PS C:\Users\Administrator> Get-ADComputer NAME | Move-ADObject -TargetPath "OU=SERVERS,OU=COUNTY, OU=STATE,OU=REGION,OU=COUNTRY,DC=subdomain,DC=mydomain,DC=com" However, I am getting this: Move-ADObject : The operation could not be performed…
Jason
  • 3,931
  • 19
  • 66
  • 107
2
votes
1 answer

MoveDataPowerShellHost.exe missing from sbserver

We are getting a lot of errors in our eventlog that indicates our sbsmonitoring DB is too big. I've had this once before, so I found a method to recreate that DB. In order to do that, I need a powershell tool called MoveDataPowerShellHost.exe which…
Terry
  • 207
  • 3
  • 9
2
votes
1 answer

Powershell: Secure Strings with Sysprep

I have two Powershell scripts I'm building for a Windows 7 image. Prior to the image I run PRE-IMAGE.ps1, and it has a line like this in it: $JoinDomainPassword = Read-Host -Prompt "Please enter the password for $joinDomainUser"…
medos
  • 123
  • 2
  • 8
2
votes
2 answers

Bizarre behavior of e-mailed reports (text files) via Task Scheduler

I’m still pretty new to powershell and practical implementations of it… but I created a script to monitor disk health and have some very bizarre results on 2012 R2. Wondering if anyone has seen the likes of this and/or has a solution… Or is it a…
Multiverse IT
  • 1,825
  • 9
  • 11