Tags "powershell-3.0" Result

Using both desktop Powershell 5.1 and Powershell Core 6.1

I was playing with PS.Core 6.1 in my VS Code - made it the default shell, opened PS debugging sessions with it, opened its console, etc ... Now I am opening the regular desktop Powershell 5.1 and get this: Windows PowerShell Copyright (C) Microsoft Corporation. All rights reserved. PS C:\Users\me> get-module ModuleType Version Name

it1352 0 2020-07-03

Running Powershell script in c# -ConvertToJson error

I would like to run power shell scripts in c#. Using the tutorial on running powershell scripts in c# from CodeProject (http://www.codeproject.com/Articles/18229/How-to-run-PowerShell-scripts-from-C) I am able to run 'most' ps scripts (they run perfect in PS), but the one I require, I receive an error when trying to use the -ConvertFrom-Json comm

it1352 2 2019-05-10

Powershell in NonInteractive mode

I use Octopus for our deployments. I have a problem with one of the Powershell scripts to control the deployment: # stops running processes $processes = @("Notepad", "Firefox") foreach ($process in $processes) { $prc = Get-Process -Name $process -ErrorAction SilentlyContinue if (-not($prc -eq $null)) { Write-Host

it1352 21 2019-05-15

How can I get the current directory in PowerShell cmdlet?

I am developing a PowerShell 3.0 cmdlet using C#/.Net 4.0 in Visual Studio 2010. I'd like to get the current directory in PowerShell where the user executes the cmdlet. But Directory.GetCurrentDirectory() doesn't work as expected. In the code below, the result is C:\Users\Administrator. Question: What cmdlet code is used to get PowerShell's curre

it1352 2 2019-05-10

How to fix DNX/DNVM in Visual Studio 2015?

Today I installed VS 2015 on Windows 7 x64. Mainly to test new .Net Core features and etc. And for test I created new C# "Console Application (Package)" solution and got this message: DNX SDK version 'dnx-clr-win-x86.1.0.0-beta5' failed to install. The solution will use DNX SDK version ‘dnx-clr-win-x86.1.0.0-beta5’ for this session. I can't c

it1352 0 2019-05-06

Determine if current PowerShell Process is 32-bit or 64-bit?

When running a PowerShell script on a x64-bit OS platform, how can you determine in the script what version of PowerShell (32-bit or 64-bit) the script is running on? Background Both 32-bit and 64-bit versions of PowerShell are installed by default on a 64-bit platform such as Windows Server 2008. This can lead to difficulties when a PowerShell

it1352 0 2019-05-06