Notities

Notities

ing. M.A.C.M. (Martijn) van den Boom

Computer Infrastructure Architect
ingenieur, docent en mentor

Social Media Links:

van den Boom

1 minuut leestijd

Function Opschonen-geheugen {

  Get-PSSession | Remove-PSSession
  [System.GC]::Collect()         
  [GC]::Collect()
  [GC]::WaitForPendingFinalizers()

  Get-Variable |
  #Where-Object { $startupVariables -notcontains $_.Name } |
  ForEach-Object {
    try {
      Clear-Variable -Name "$($_.Name)" -Force -ErrorAction SilentlyContinue -WarningAction SilentlyContinue
      Remove-Variable -Name "$($_.Name)" -Force -Scope "global" -ErrorAction SilentlyContinue -WarningAction SilentlyContinue
      Remove-Variable -Name "$($_.Name)" -Force -ErrorAction SilentlyContinue -WarningAction SilentlyContinue
      #Write-Host "Variabele '$($_.Name)' is opgeruimd."
    }
    catch [Exception] {
      if ($_.Name -notlike '') { Write-Host "An error has occured. Error Details: $($_.Exception.Message)" }
    }
  }

  #Get-Variable

}

Recente berichten

Categorieën

Over Mij

Sponsor me link:
ko-fi.com/martijnvandenboom
paypal.me/ingmacmvandenboom
buymeacoffee.com/ingvdboom