With the Get Profile Handle (QSYGETPH) and Set Profile Handle (QWTSETP) APIs, this task is easy.
By Tom Snyder
One common issue to deal with when accessing network drives from the IBM i is authority. When you access a network drive from the IBM i, as discussed in previous TechTips, the user profile that is assigned to the job is the user that is being authenticated on the Windows server. One way to resolve this is to synchronize the passwords between the IBM i and Windows, but this will reduce your password protection to the level of the Windows server, because once someone cracks the Windows password protection, they now have the IBM i user name and password.
In this TechTip, I will show you how to change the active user profile for the currently running job.