Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <# ==============================================================================================
- Copyright (c) 2019 by Matthias Schaffer
- NAME: Find-MSIGUID.ps1
- COMMENT: Show Software GUID
- HISTORY:
- Rel. 1.0, 06.02.2019, fellwell5
- VERSION: 1.0, fellwell5
- All rights reserved.
- ============================================================================================== #>
- # requires -version x
- # change Window Title
- $host.ui.RawUI.WindowTitle = “Find-GUID”
- Add-Type -AssemblyName System.Windows.Forms
- $Form = New-Object system.Windows.Forms.Form
- $Label2 = new-object system.windows.forms.Label
- $Label2.Font = 'Arial,12pt'
- $Label2.Text = ""
- $Label2.AutoSize = $True
- $Label2.Location = new-object system.drawing.size(5,5)
- $System_Drawing_Size = New-Object System.Drawing.Size
- $System_Drawing_Size.Width = 360
- $System_Drawing_Size.Height = 20
- $progressBar1 = New-Object System.Windows.Forms.ProgressBar
- $progressBar1.Name = 'progressBar1'
- $progressBar1.Value = 0
- $progressBar1.Style="Continuous"
- $progressBar1.Size = $System_Drawing_Size
- $progressBar1.Left = 5
- $progressBar1.Top = 35
- $Form.Controls.Add($Label2)
- $Form.Controls.Add($progressBar1)
- $Form.AutoScroll = $True
- $Form.AutoSize = $True
- $Form.MinimizeBox = $False
- $Form.MaximizeBox = $False
- $Form.AutoSizeMode = "GrowAndShrink"
- $Form.StartPosition = "CenterScreen"
- $Form.Topmost = $True
- $Icon = [system.drawing.icon]::ExtractAssociatedIcon($PSHOME + "\powershell.exe")
- $Form.Icon = $Icon
- $AnimationCount = 0
- Write-Host "#####################################"
- Write-Host "#### Find GUID ####"
- Write-Host "#### fellwell5 06.02.2019 ####"
- Write-Host "#####################################"
- Write-Host
- $search = Read-Host -Prompt 'Programmname eingeben'
- if(-Not ($search.StartsWith("*"))){
- $search = "*$search"
- }
- if(-Not ($search.EndsWith("*"))){
- $search = "$search*"
- }
- $Form.Add_Shown({$Form.Activate()})
- [void] $Form.Show()
- $Label2.Text = "Es wird nach $search gesucht."
- $search_job = start-job -Name Job -ScriptBlock {
- Param($search)
- $WMI = Get-WmiObject win32_Product | where {$_.name -like "$search"}
- if($WMI.Count -eq 0){
- Write-Host "Kein Programm für $search gefunden." -BackgroundColor Red
- }else{
- $WMI
- }
- } -ArgumentList $search
- while ($search_job.JobStateInfo.State -eq "Running"){
- if ($AnimationCount -gt 99){$AnimationCount = 0}
- $AnimationCount++
- $progressBar1.Value = $AnimationCount
- $Form.Refresh()
- Start-Sleep -Milliseconds 100
- }
- $progressBar1.Value = 100
- $Form.Close()
- $search_job | Receive-Job -AutoRemoveJob -Wait
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement