This script removes the Windows Server Backup role from the servers listed in a text file. One server name on each row. The script can easily be edited to remove other roles as well.
This script reads the list of servers to remove the Windows Server Backup role from from a text file located at the specified path. It then loops through each server in the list and checks if the Windows Server Backup role is installed on the server. If the role is installed, the script uninstalls it and adds a result object to an array with the server name and the result (either ”Success” or ”Already Uninstalled”). After the loop is complete, the script exports the array of results to a CSV file at the specified output file path.
Note that this script assumes that you have the necessary permissions to uninstall roles and features on the target servers. You may also need to modify the script to handle any dependencies or other issues that may arise during the uninstallation process.