IT:AD:Code:HowTo:PowerShell:Setup For Development

Summary

Open the folder containing your scripts.

  • Start IT:AD:Code in a new directory.
  • Ctrl+Shift+P, then userto edit the user settings.json file for that folder.
    • On the right, provide the following:

// Place your settings in this file to overwrite the default settings
{
    "editor.lineNumbers": true,
    "terminal.integrated.shell.windows": "C:\\Windows\\sysnative\\WindowsPowerShell\\v1.0\\powershell.exe",
    "powershell.developer.powerShellExePath": "C:\\Windows\\sysnative\\WindowsPowershell\\v1.0\\powershell.exe"
}

  • Create a test.ps1 file. Add a method
example
function Get-Hello(){
  Write-Host "Hi!"
}

To run it, you have to open a Execution Environment:

# Existing:
Ctrl-`

# or new one:
Ctrl-Shift-`

Load the file:

./YourFile.ps1

Then run it.

Gay-Hello

But loading up files on the command line is a PIA.

Use IT:AD:Pester:HowTo:Create Tests

Pretty straightforward1).


  • /home/skysigal/public_html/data/pages/it/ad/code/howto/powershell/setup_for_development/home.txt
  • Last modified: 2023/11/04 02:45
  • by 127.0.0.1