In a previous post I presented a powershell script to attach a timestamp suffix to files or folders backed up prior to a deployment. At the point of writing that post I wasn’t aware of a collection of runtime variables that are available in your powershell script.
Below is alternate script to the last one I presented. The suffix in this script is not using the current date and time but the $ReleaseId variable which is a number. Each time a new released is created and executed this variable will contain a new value but remember a release maybe re-tried in which case this value will not change. You could also use the $BuildNumber variable (alter line 7) which is the unique Id TFS assigns to the build and is a number.