Top "Powershell-4.0" questions

For topics and problems related specifically to Windows PowerShell 4.0. PowerShell 4.0 shipped with the releases of with Windows 8.1 and Windows 2012 R2.

How to run the .reg file using PowerShell?

I want to run the .reg file (registry file) using PowerShell Script but I am not able to run it. …

powershell automation powershell-3.0 powershell-4.0 powershell-5.0
How do I get PowerShell 4 cmdlets such as Test-NetConnection to work on Windows 7?

The situation. On a Windows 7 SP1 machine, I have updated with Windows6.1-KB2819745-x64-MultiPkg.msu. Furthermore, in PowerShell $PSVersionTable …

powershell windows-7 powershell-4.0
Setup default date format like yyyy-mm-dd in Powershell?

A simple & short question: How can I setup a default date format in powershell like yyyy-mm-dd ? so any date …

powershell powershell-2.0 powershell-3.0 powershell-4.0
Find numbers after specific text in a string with RegEx

I have a multiline string like the following: 2012-15-08 07:04 Bla bla bla blup 2012-15-08 07:05 *** Error importing row no. 5: …

regex string powershell string-matching powershell-4.0
PowerShell string default parameter value does not work as expected

#Requires -Version 2.0 [CmdletBinding()] Param( [Parameter()] [string] $MyParam = $null ) if($MyParam -eq $null) { Write-Host 'works' } else { Write-Host 'does not work' } Outputs "…

powershell powershell-4.0
Split a string with powershell to get the first and last element

If you do: git describe --long you get: 0.3.1-15-g3b885c5 Thats the meaning of the above string: Tag-CommitDistance-CommitId (…

powershell powershell-4.0
rename-item and override if filename exists

I am trying to use the Rename-Item cmdlet to do the following: I have folder which contains "*.txt" files. Let's …

powershell powershell-4.0 foreach-loop-container
Output the date/time in PowerShell

I want to output the date time in various places in my script for logging so I am doing this: $…

powershell powershell-4.0
Error Handling for Invoke-RestMethod - Powershell

I have a powershell script using the Skytap API (REST). I would like to catch the error, if there is …

rest http error-handling powershell-4.0
Zip and Unzip File in Powershell 4

I am using Windows Server 2012 R2 (64 bit). I have powershell version 4 available in it. I am trying to zip and …

powershell zip unzip powershell-4.0