The first part enables xp_cmdshell (which is disabled by default)
EXEC sp_configure 'xp_cmdshell', 1
RECONFIGURE
go
Here we are creating a login for testing purposes only
CREATE LOGIN TommyTest WITH PASSWORD = '@dyln1234&'
go
CREATE USER TommyTest FROM LOGIN TommyTest
go
Now create the proxy account
EXEC sp_xp_cmdshell_proxy_account 'MyDomain\MyDomainAccount,'@dyln1234&'
Grant permissions on xp_cmdshell to the test account
GRANT EXECUTE ON xp_cmdshell to TommyTest
go
Validate everything is working
EXECUTE AS login = 'TommyTest'
EXEC xp_cmdshell 'DIR C:\*.*'
go
Tommy
Follow @sqlscribe