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 6628029
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T22:05:00+00:00 2026-05-25T22:05:00+00:00

I have VB Script: ….. Set oInstaller = CreateObject(WindowsInstaller.Installer) Set otempDB = oInstaller.OpenDatabase(sMsiFullPathTemp, 1)

  • 0

I have VB Script:

.....
Set oInstaller  = CreateObject("WindowsInstaller.Installer")
Set otempDB = oInstaller.OpenDatabase(sMsiFullPathTemp, 1)
.......
Set otempDB = Nothing

At this string it releases database: Set otempDB = Nothing.

I need to make PowerShell script like this VBS to work with MSI.

PowerShell:

....
function Invoke-Method ($Object, $MethodName, $ArgumentList) {
    return $Object.GetType().InvokeMember($MethodName, 'Public, Instance, InvokeMethod', $null, $Object, $ArgumentList)
}
$oInstaller = New-Object -ComObject WindowsInstaller.Installer
$otempDB = Invoke-Method $oInstaller OpenDatabase  @($tempmsi, 1)

But how I can release MSI database until script haven’t finished work?
I mean something like: Set otempDB = Nothing

Could someone help me with it?

Thanks

  • 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-25T22:05:00+00:00Added an answer on May 25, 2026 at 10:05 pm

    you can always assign the variable to $null:

    $otempDB = $null
    

    However for COM objects this often results in the object just being shuffled off to limbo somewhere. Better is to explicitly relese the object and clean up the memory:

    ([System.Runtime.InteropServices.Marshal]::ReleaseComObject([System.__ComObject]$otempDB) -gt 0)
    [System.GC]::Collect()
    [System.GC]::WaitForPendingFinalizers()
    

    Somewhere I came across a function for this some time ago (if someone knows who originally posted this function please leave a comment and I will attribute it). I use it pretty much any time that I work with COM objects:

    function Release-Ref ($ref) {
    
        ([System.Runtime.InteropServices.Marshal]::ReleaseComObject([System.__ComObject]$ref) -gt 0)
        [System.GC]::Collect()
        [System.GC]::WaitForPendingFinalizers()
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

anyone have script or procedures to install SQL Server 2008 Express, set up the
I have script like this : fullscript.sh if [ ! -f /opt/laks/linux-2.6.33.2.tar.bz2 ] then
I have this script that I am currently running that works great for all
I have script with defined class (for instance, Singleton.php). This class implements classic singleton
i have script like this $('.parent a').live('mouseover mouseout', function(event) { if (event.type == 'mouseover'){
I have this script in index.php file: <script type=text/javascript> $(document).ready(function(){ $('#ads').load('output.php').fadeIn('slow'); }); </script> And
I have script.sh that must be run as user2. However, this script can only
I have a question. In my file content.html I have script. When load this
I have script like this : $(#addk).bind(click, function(event){ //alert(here!); $(#loader-overlay).show(); $.ajax({ 'async':False, 'type': POST,
I have a script where the user should be able to enter a string

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.