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.

PsObject array in powershell

This is my code : $a = @() for ($i = 0; $i -lt 5; $i++) { $item = New-Object PSObject $item | Add-Member -type NoteProperty -Name 'Col1' …

powershell powershell-4.0
How to unzip a Zip File with Powershell Version 2.0?

This works for me with PowerShell version 4.0 or higher. But at PowerShell version 2.0 the Add-Type isn't possible (type doesn't exist). …

powershell powershell-2.0 powershell-4.0
Replace string in powershell array

This is my array : $array who contains theses values : Y:\155150716070\00000027.JPG Y:\155150716070\00000028.JPG Y:\155150716070\00000029.JPG Y:\155150716070\00000030.JPG Y:\155150716070\00000031.JPG Y:\155150716070\00000032.…

arrays powershell powershell-3.0 powershell-4.0
PowerShell PSScriptRoot is null

When I run $PSScriptRoot it returns null. I am using PS version 4. $val = Join-Path -Path $PSScriptRoot WebPlatformInstaller_amd64_en-US.msi …

powershell powershell-4.0
Replace a character with new line

Powershell ver 4. Windows 7 I wanted to replace , with new lines in a text file. I tried the script below (Get-Content …

powershell powershell-4.0
Check If a program is installed on multiple computers using Powershell

I'm having issue with a script I've written and would love some help. Please note I'm very new to powershell. …

powershell-4.0 installed-applications
Refreshing Excel Sheets using powershell

I have 10 excel different excel sheet in one folder named test. I want to refresh the data connection and data …

excel powershell powershell-2.0 powerpivot powershell-4.0
How do I pass a local variable to a remote `Invoke-Command`?

I'm trying to retrieve the hash of a file located on remote server using Invoke-Command. It works fine when I …

powershell powershell-remoting powershell-4.0
Powershell concatenate an Environment variable with path

So I have this code: $userprofile=Get-ChildItem Env:USERPROFILE $localpath="$userprofile\some\path" I would expect output of the below …

string environment-variables filepath powershell-4.0
Extract value from JSON

I am trying to use PowerShell to extract value from JSON object, I have the following JSON: { "$schema": "http://schema.…

json powershell powershell-4.0