The attached ZIP file contains two demo scripts for adding or removing a bare metal server build with Cisco UCS. The script requires several other scripts to complete the function. The scripts are also on this community page. They are:
Create a secure credentials file
Create Service Profile from Template
Clone a NetApp C-Mode LUN to work with UCS
Generate SAN Zones for Cisco or Brocade with UCS
Multi-UCS Domain KVM Launcher PowerShell Script
If you download and unzip each of these into a single directory and review the integrated help for each one you should be able to successfully customize the settings in the demo script and other scripts for your needs.
The requirements for this functionality to operate correctly is Cisco UCS with Fabric Interconnects, Cisco MDS or Brocade SAN Fabrics, NetApp C-Mode arrays, PowerShell version 3 or above and the Cisco UCS PowerTool.
Again, this script is just used for demonstrating how scripts can be combined into a workflow that can accomplish common automation tasks and it not ready for production use. Please use this code base to make it ready for you and your organization and feel free to share the results on Cisco Communities.