I want to run cmd as an administrator on VSTS.
Actaully I am trying to install git-tfs with chocolatey tool manager on VSTS hosted agent, So I am running the following command on VSTS command line task:
@"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
or,
Alternatively VSTS also provides the chocolatey task for installation, you can see this in the screenshot :
Both of the above approaches giving the same error: