Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7165883
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T14:19:25+00:00 2026-05-28T14:19:25+00:00

Does anyone know how I can load a DLL without having it on each

  • 0

Does anyone know how I can load a DLL without having it on each remote server I am using in a persistent connection and running the invoke-command cmdlet with?

I am using DotNetZip to backup folders on about 13 servers. Everything is working locally, but when it gets to a remote server (the first one in the array is the local server), it errors because it doesn’t see the DLL on the remote server.

I execute this script on one server and it should zip up folders on each remote server:

foreach($i in $appServers) {
        $sessionForI = New-PSSession -computername $i
        Invoke-Command -Session $sessionForI -ScriptBlock {
            if (!(Test-Path -path C:\\newDeploy)) {
                New-Item C:\\newDeploy -type directory
            }
            [System.Reflection.Assembly]::LoadFrom("C:\\newDeploy\\Ionic.Zip.dll");
            $directoryToZip = "C:\\Program Files (x86)\\SubDir\\$folder"
            $zipfile = new-object Ionic.Zip.ZipFile
            $e = $zipfile.AddSelectedFiles("name != '*.e2e'",$directoryToZip, "",1)
            if (!(Test-Path -path C:\\newDeploy\\backup)) {
                New-Item C:\\newDeploy\\backup -type directory
            }
            $zipfile.Save("C:\\newDeploy\\backup\\" + $folder+ ".zip")
            $zipfile.Dispose()
        }
        remove-PSSession -session $sessionForI
    }

Thank you .

-Jim

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T14:19:26+00:00Added an answer on May 28, 2026 at 2:19 pm

    I’m pretty sure you are going to need to copy Ionic.Zip.dll to the remote machines to do this. You could try sharing it out from your lead system and using a UNC path to load it from the remote machines (i’ve never tried that… going to now…) 🙂

    Update – yep just confirmed you can pass a UNC path to [System.Reflection.Assembly]::LoadFrom.

    Update 2 – While the assembly loaded, using it didn’t work so well:

    Exception calling "AddFile" with "1" argument(s): "Request for the permission of type 'System.Security.Permissions.File
    IOPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed."
    At line:1 char:11
    + $z.AddFile <<<< ("C:\AMCleanUp.log")
        + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
        + FullyQualifiedErrorId : DotNetMethodException
    

    When I loaded a local copy of the the DLL the AddFile method worked fine. You’re only option might be to copy this DLL to all your servers…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does anyone know how I can load a Ruby on Rails partial into a
Does anyone know how I can check if a string contains well-formed XML without
I have an Ontology written in OWL. Does anyone know I can load it
Does anyone know if one can host a website using the VMRole in Windows
Does anyone know how can I cut a string and then assign into an
Does anyone know how can I detect the browser type in css? What I
Does anyone know where can I find recent data on PHP4 vs PHP5 market
Does anyone know how can I catch a mail error (error is displayed while
Does anyone know how can I edit a subitem on a listView? I've tried
I know I can use Request.Browser.IsMobileDevice . But does anyone know how it works,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.