dbatools is a free PowerShell module with over 300 SQL Server administration, best practice and migration commands included.

Please note that documentation and command names may be out of date while we work furiously towards 1.0


Adds one or more proxies to SQL Server Agent.




Creates an Agent Proxy on sql2016 with the name STIG with the ‘PowerShell Proxy’ credential.
The proxy is automatically added to the CmdExec subsystem.

New-DbaAgentProxy -SqlInstance sql2016 -Name STIG -Credential ‘PowerShell Proxy’

Creates an Agent Proxy on sql2016 with the name STIG with the ‘PowerShell Proxy’ credential and the following principals:
Login: ad\sqlstig
ServerRole: securtyadmin
MsdbRole: ServerGroupAdministratorRole

By default, only sysadmins have access to create job steps with proxies. This will allow 3 additional principals access:
The proxy is then added to the CmdExec and PowerShell subsystems

New-DbaAgentProxy -SqlInstance localhost\sql2016 -Name STIG -Credential ‘PowerShell Proxy’ -Description “Used for auditing purposes” -Login ad\sqlstig -SubSystem CmdExec, PowerShell -ServerRole securtyadmin -MsdbRole ServerGroupAdministratorRole


This command was created by Chrissy LeMaire. You can find Chrissy on Twitter.


From PowerShell, execute Get-Help New-DbaAgentProxy -Detailed for more information on this function.

Source Code

Want to see the source code? View New-DbaAgentProxy.ps1 on GitHub

Related commands