Write a PowerShell script that takes the parameters you want to capture.
Turn it into a custom Tool that takes those parameters (Arguments would be, for example: -BuildNumber '__Build Number__').
Make a new Component that uses that tool.
Pass in the parameters (e.g. $(BuildNumber))
The system variables you can pass in are:
ApplicationPath Destination path, including the component name, where the component is copied.
ApplicationPathRoot Destination path where the component is copied. The default is C:\Windows\dtlDownloads. You can over-ride this
value to specify an alternative destination path.
BuildDefinition Build definition for the component.
BuildNumber Build number for the component.
Environment The environment for the release.
PackageLocation The source path from which the component is copied. For builds dropped to a Standard server, the path points to
the container-id. For builds dropped to Azure, the path points to the
storage blob GUID.
ReleaseId The ID of the release; this is assigned by Release Management.
ReleaseNumber The number of the release.
Stage The stage of the release.
Tag Tag used to group the server which is running the action.
If your using WebDeploy you could add the release info file to your web application with blank/default values and use Parameterization to transform it during your deployment using the SetParam flag on your MSDeploy or deploy.cmd call.