Search code examples
sql-serverssisetlsql-server-data-tools

Getting the user who ran the SSIS Package


In my SSIS package I have the need to know what the windows user ID is of the user who executed the package.

I wrote an SSIS package that is manually executed from within a WPF application and I need to know the windows UserId.


Solution

  • If you need to use the username of the person that executed the package you can use this built in system variable:

    @[System::UserName]
    

    If the logged in user needs to be used in a Script Task you can do it this way:

    Dts.Variables("System::UserName").Value
    

    NOTE The full path (domain + userid) is returned. You may need to use string functions to extract the userid from the domain.