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:
Copyright (C) Microsoft Corporation. All rights reserved.
PS C:\Users\me> get-module
ModuleType Version Name
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
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",
foreach ($process in $processes)
$prc = Get-Process -Name $process -ErrorAction SilentlyContinue
if (-not($prc -eq $null))
I have requirement to download files from simple storage service to local folder
and count the no.of files in local folder and check against simple storage service then send mail with the number of files.
I tried to download files from simple storage service but I am getting error like get-s3object commandnotfoundexception. How do I resolve this i
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
I've been giving PowerShell (v3.0) a shot for the first time today, and became enormously frustrated with the strange way some of its error-handling concepts are implemented.
I wrote the following piece of code (using the Remote Registry PowerShell Module)
New-RegKey -ComputerName $PCName -Key $Key -Name $Value
Write-Host -fore Gree
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-x184.108.40.206-beta5' failed to install. The solution will use DNX SDK version ‘dnx-clr-win-x220.127.116.11-beta5’ for this session.
I can't c
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?
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
When attempting to use any of the #Requires commands, for example:
#Requires -Version 3.0
They error with the text:
An error occurred while creating the pipeline.
CategoryInfo : NotSpecified: (:) , ParentContainsErrorRecordException
FullyQualifiedErrorId : RuntimeException
I've tested this on ISE and the Consol
Is it possible to run PowerShell 1.0 (or 2.0 CTP) backed by the 3.5 runtime instead of 2.0?
We're building a .NET 3.5 solution, and I'd still like to use PowerShell as our scripting engine for scheduled tasks, etc.
I don't need LINQ syntax or anything, just the 3.5 libraries and runtime.
FOLLOWUP: thank you for the reply about dynamically load