Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Del C:\Support\Scripts\Security\MSERT\*.exe
- $TargetUri = (Invoke-WebRequest "https://go.microsoft.com/fwlink/?LinkId=212732").BaseResponse.RequestMessage.RequestUri.AbsoluteUri
- Invoke-WebRequest $TargetUri -OutFile C:\Support\Scripts\Security\MSERT\MSERT.exe
- $msertFile = Get-Item .\msert.exe
- $version = $msertFile.VersionInfo.ProductVersion
- $newName = $msertFile.BaseName
- $newName = $newName + "." + $version
- $newName = $newName + "." + "exe"
- ren $msertFile $newName
- Invoke-Expression '& ".\$newName" /Q /F'
- Clear-Host
- Do
- {
- Clear-Host
- $msert = Get-Process MSERT* -ErrorAction SilentlyContinue
- If($msert -ne $null)
- {
- Write-Host "The time is "$(Get-Date -f yyyy-MM-dd-h-m)"and MSERT is running."
- }
- Start-Sleep 300
- } While ($msert -ne $null)
- $filename = 'msert.log'
- $source = 'C:\Windows\Debug\' + $filename
- $target = 'C:\Support\Scripts\Security\MSERT\' + $filename + '.' + $(Get-Date -f yyyy-MM-dd-h-m)
- Move-Item $source $target
Advertisement
Add Comment
Please, Sign In to add comment