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

0 Comments

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

Run PowerShell or batch file remotely

0 Comments

  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

Using C# in PowerShell to move files

0 Comments

  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()