Skip to content

Instantly share code, notes, and snippets.

@zjbennett zjbennett/clean.ps1
Last active Feb 18, 2019

Embed
What would you like to do?
Powershell Script for cleaning and removing v2.5 and upgrade to 3.5
# Set the values as needed
$QoS = "HKLM:\Software\Policies\Microsoft\Windows\QoS\Lync QoS"
#Copy Node Config
Write-Host "Copy the Node Config to Desktop" -ForegroundColor Green
Copy-Item "C:\TestNode\NodeConfig.xml" -Destination "C:\Users\modtest\Desktop"
#Delete TestNode Folder
Write-Host "Deleting Directory and Files" -ForegroundColor Green
Remove-Item -path "C:\TestNode\*.*" -Recurse
#Stop and Disable Service
Write-Host "Stoping/Disabling service.... this may take a while... (Yellow Warnings means its working!!)" -ForegroundColor Green
Set-Service -Name "TestNode" -StartupType "Disabled"
Stop-Service -Name "TestNode"
# Set the Regedit Key
Remove-ItemProperty -Path $QoS -Name "Application Name"
New-ItemProperty -Path $QoS -Name "Application Name" -Value "NodeWorker.exe" -Type String
#Delete TestNode Folder
Write-Host "Running second clean up of files" -ForegroundColor Green
Remove-Item -path "C:\TestNode\*.*" -Recurse
#Removes Event Log Files for old Modality Event Log.
Remove-EventLog -LogName "Modality Test Node"
Write-Host "Script has been completed. New Registry Key Added, Old Service Stopped and Disabled, Deleted the old directory." -ForegroundColor Green
#Runs new Node Setup.
Read-Host -Prompt "Press Enter to continue and install Node Setup"
.\NodeSetup.exe
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.