Run Commands in Powershell to Test

How can a person run these commands from within powershell to do pre-testing before putting into script and see what results are ahead of time.

Example in the help it says type Get-Help Command -detailed I can’t do Import-Module.

You can dot-source the toolkit and then you will have them available in your session.

Change to the .\AppDeployToolkit folder and run:

. .\AppDeployToolkitMain.ps1

This will load the toolkit in the current session and you can test the various commands.

I have tried that and I just get for example:

get-help Get-InstalledApplication -examples

get-help : Get-Help could not find Get-InstalledApplication in a help file in this session. To download updated help
topics type: “Update-Help”. To get help online, search for the help topic in the TechNet library at
http://go.microsoft.com/fwlink/?LinkID=107116.
At line:1 char:1

  • get-help Get-InstalledApplication -examples
  •   + CategoryInfo          : ResourceUnavailable: (:) [Get-Help], HelpNotFoundException
      + FullyQualifiedErrorId : HelpNotFound,Microsoft.PowerShell.Commands.GetHelpCommand

That error is telling you that the function does not exist in your session. Be sure to type:

. .\AppDeployToolkitMain.ps1

You should then be able to use tab completion to find the command and parameters. If not, it’s not loaded.

I’m not able to test commands manually outside of running the whole deploy-application.ps1 file. Can someone explain step by step how to do this in Powershell ISE prompt?

I use PowerGUI (Very old) but the same trick will work in Powershell ISE.

  1. Open deploy-application.ps1 file in Powershell ISE.
  2. set a breakpoint just before `If ($deploymentType -ine ‘Uninstall’ -and $deploymentType -ine ‘Repair’) {
  3. Run the deploy-application.ps1 script inside of Powershell ISE.
  4. when it hits the breakpoint, do Shitf-F5 to stop executing.
  5. NOW, all the PSADT commands should be known to Powershell ISE and you should be able to use tab completion to find the command and parameters.