Recently I ran into a few issues when using Visual Studio Release Management in combination with Windows Server 2008 R2.
Eventually I got it to work, but it took quite some troubleshooting.
In VSTS RM I would like to use a PowerShell script that runs from the network.
Before 2008 R2 can be used, there are a few prerequisites that need to be in place on your target before we can start, these are:
- The .NET Framework 4 or higher
- PowerShell 4
After these were in place there was an error:
AuthorizationManager check failed
A command that prompts the user failed because the host program or the command type does not support user interaction. The host was attempting to request confirmation with the following message: Run only scripts that you trust. While scripts from the internet can be useful, this script can potentially harm your computer. If you trust this script, use the Unblock-File cmdlet to allow the script to run without this warning message. Do you want to run Script.ps1?
This indicates that the file is blocked, but when I run the PowerShell command:
Get-Content -Path '.\Script.ps1' -Stream Zone.Identifier
to find out if the file is blocked (more explanation here) it does not display any blocked files. If it did, I could run Dir .\ –recurse | unblock-file
Then I tried run
as decribed here. No success
In the end it turned out that the network location isn’t trusted so I needed to log on to the target server with the account I use in VSTS RM to run the script and when logged on to the server, add file://*.<domain name> to the Local Intranet sites. Or only the network location that needs to be trusted.
In the PowerShell step in VSTS RM it is necessary to add the domain suffix to the location of the script otherwise it will still not work. After this is done, the script will run perfectly.