0

I have a powershell script that references dll files and i would like to distribute this script to customers. How can i do this such that the customers don't have to worry installing/referencing correct dll files?

I reference the dll files from within the script in the following way:

Add-Type -Path <local path to dll>

I am looking for a way to either bundle these dll's along with the script , or some way for powershell to install the dll when it runs. The dll's i am interested in are available as following nuget packages:

  1. Sharepoint Client
  2. Active Directory library
1

1 Answer 1

1

You could try copying the dll files to the directory the script is in and then use "$PSScriptRoot\Name.Of.File.dll". Zip the directory and distribute the Zip file.

Sign up to request clarification or add additional context in comments.

2 Comments

This is how I always do it, in my opinion the most clean way to do this.
$PSScriptRoot gives no output (WS 2019, PSVersion: 5.1.17763.2268).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.