Fix: Visual Studio 2013 / 2014–SQL Server 2014 – The term ‘Invoke-Sqlcmd’ is not recognized as the name of a cmdlet

  Note When you want to run / edit / debug PowerShell scripts inside Visual Studio 2013 / 2015 you will have to install the “PowerShell Tools for Visual Studio” Visual Studio extension found at: https://visualstudiogallery.msdn.microsoft.com/c9eb3ba8-0c59-4944-9a62-6eee37294597   I wanted to run and debug a PowerShell script inside Visual Studio 2013 …

Use formatting–f, when writing to the output console with PowerShell

If you want to format a string when echoing to the screen, use parentheses. Echo("This is {0} " -f "a test.")   Will output: This is a test.   Note http://stackoverflow.com/questions/17623644/what-is-the-difference-between-echo-and-write-host-in-powershell echo is an alias for Write-Output, which writes to the Success output stream. This allows output to be processed …

Run PowerShell or batch file remotely

  To configure Windows PowerShell to receive remote commands in DEV http://www.howtogeek.com/117192/how-to-run-powershell-commands-on-remote-computers/ Start Windows PowerShell with the "Run as administrator" option. On server: enable-psremoting On server: Set-ExecutionPolicy Unrestricted On server: Set-Item wsman:\localhost\client\trustedhosts * (allows any computer to connect) On server: Restart-Service WinRM On client: Set-ExecutionPolicy Unrestricted On client: Set-Item wsman:\localhost\client\trustedhosts …

How to start a process / application on an other computer from C#, by using PowerShell remoting

  You van execute a process on an other machine from C#, by using the code below:   Example for calling the function var rc = new RemotingComponent(null); rc.RunRemoteProcess ( @"MyMachine1", "MyMachine1\Administrator", "MyPassword1", @"C:\Windows\System32\notepad.exe", string.Empty ); C# class using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Management.Automation; using System.Management.Automation.Runspaces; …

Using C# in PowerShell to move files

  Screedump form Windows PowerShell ISE     Code $source = @" using System; using System.Collections.Generic; using System.Text; using System.IO; namespace Rvl.Demo.Common {     public class MoveFiles     {         public static void Move()         {             string sourceFolder = @"C:\BDATA\Test\Source"; // Source folder             string destinationFolder = @"C:\BDATA\Test\Destination"; // …

PowerShell function to build a Microsoft Visual Studio setup project from command line with devenv.exe

If you want to build you’re Microsoft Visual Studio 2010 setup project in release mode, from the command line, you can use the following PowerShell function: function RebuildSubsystem([string]$solutionPath, [string]$projectPath, [string]$devEnvPath) {     $parameters = "/Rebuild Release ""$solutionPath"" /Project ""$projectPath"" /ProjectConfig Release"     "Process to start [$devEnvPath $parameters]"     $process = …