1

Right now I'm learning the Powershell App Deployment Toolkit. PSADT is used in software deployment, to have more control over (silent-)installs, (silent-)uninstalls and repairs of software. To work as expected, it needs a certain directory-structure, which looks like this:

Source
│   Deploy-Application.exe
│   Deploy-Application.exe.config
│   Deploy-Application.ps1
│
├───AppDeployToolkit
│       AppDeployToolkitBanner.png
│       AppDeployToolkitConfig.xml
│       AppDeployToolkitExtensions.ps1
│       AppDeployToolkitHelp.ps1
│       AppDeployToolkitLogo.ico
│       AppDeployToolkitMain.cs
│       AppDeployToolkitMain.ps1
│
├───Files
│       installer.msi
│
└───SupportFiles
        info.txt
  • The Deploy-Application.ps1 is the place where you put your own logic.
  • The AppDeployToolkitMain.ps1 stores the toolkit-functions.
  • From inside the Deploy-Application.ps1 you can call all functions declared in AppDeployToolkitMain.ps1.
  • With AppDeployToolkitHelp.ps1 you can overview all usable commands with the synopsis (syntax etc.).

For the purpose of debugging I want to try all commands outside of the AppDeployToolkitMain.ps1 in a normal powershell. It know that I could just copy out every function and make a new .ps1-file, but this seems too tideous. Also I think some functions depend on each other, so I had to copy or read through everything.

Is there a way to import the AppDeployToolkitMain.ps1, so I can try out every function?

hmaier
  • 73

1 Answers1

1

If you wish to include in one script the functions from another script, see Chapter 10 - Script modules :

The function needs to be loaded into the Global scope. That can be accomplished by dot-sourcing the script that contains the function. The relative path can be used.

. .\Get-MrPSVersion.ps1

The fully qualified path can also be used.

. C:\Demo\Get-MrPSVersion.ps1
harrymc
  • 498,455