powershell 清理Imsim安装(Windows)

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了powershell 清理Imsim安装(Windows)相关的知识,希望对你有一定的参考价值。

<#
    Script to clean all of the Stadlerrail Imsim Apps and data stored and used by it
#>

# Get all of the application installed with Vendor parameter equals 'Stadlerrail'
Write-Information "Collecting data for installed application ..."
$stadlerrailApps = Get-WmiObject -Class Win32_Product -Filter "Vendor = 'Stadlerrail'"

if ($stadlerrailApps.Length -eq 0) {
  Write-Warning "There are no application installed. If you disagree - you should remove it manually"
}

# Uninstall in loop
foreach ($app in $stadlerrailApps) {
  Write-Information "Removing $($app.Name) ..."
  $app.Uninstall()
}

# Get default storage path
$appLocalStorage = Join-Path -Path $env:USERPROFILE -ChildPath ".imsim"
Write-Information "Default local storage path is [$appLocalStorage]. Checking if it exists ..."

# Check if folder exists and remove it
if (Test-Path $appLocalStorage) {
  $message = "Found [$appLocalStorage]."
  $question = 'Are you sure you want to remove it?'
  $choices  = '&Yes', '&No'
  $decision = $Host.UI.PromptForChoice($message, $question, $choices, 1)
  if ($decision -eq 0) {
    Write-Information "Removing local storage ..."
    Remove-Item -Path $appLocalStorage -Recurse -Force
  } else {
    Write-Information "Oki-Doki"
  }  
} else {
  Write-Warning "No local storage found. Guess its OK"
}

Pause

以上是关于powershell 清理Imsim安装(Windows)的主要内容,如果未能解决你的问题,请参考以下文章

powershell 在SysPrep之前清理图像

powershell 文件夹清理

powershell 清理bin调试文件夹

使用 Powershell 清理孤立的 Active Directory 用户配置文件文件夹

powershell [删除包,bin和obj文件夹删除包,bin和obj资料夹]用来快速清理解决方案里面非必要档案减少空间#powershell

powershell 清理和交叉连接包含具有由comman或换行符分隔的多个条目的单元格的excel表