2017-06-07 51 views

回答

0

微軟對如何做到這一點用Visual Basic

https://msdn.microsoft.com/en-us/library/windows/desktop/ms684192(v=vs.85).aspx

下面的PowerShell會增加內存限制的文件。您將需要$的AppID和$ CLSID更改爲相應的標識符

$AppID = "{11111111-1111-1111-1111-111111111111}" 
$CLSID = "{22222222-2222-2222-2222-222222222222}" 
$comAdmin = New-Object -comobject COMAdmin.COMAdminCatalog 


function ConfigurePoolLimits ($comAdmin , $MemoryLimit) { 
    Write-Host "Configuring Pool Limits" 

    $apps = $comAdmin.GetCollection("Applications") 
    $apps.Populate(); 
    $changesMade = $false 
    foreach ($app in $apps) { 
     if ($app.Name -eq $AppName) { 
      Write-Host "Found Application $($app.Name)" 
      Write-Host "RecycleMemoryLimit is $($app.Value("RecycleMemoryLimit"))" 
      if ($app.Value("RecycleMemoryLimit") -ne $MemoryLimit) { 
       $changesMade = $true 
       Write-Host "Changing RecycleMemoryLimit to $($MemoryLimit)" 
       $app.Value("RecycleMemoryLimit") = $MemoryLimit 
      } 
     } 
    } 
    if ($changesMade) { 
     $apps.SaveChanges(); 
    } 
} 

然後用2個參數

ConfigurePoolLimits $comAdmin 1000000 
調用函數