I like it, this is a good step in the right direction. It's not only cleaner, but probably safer since there won't be need to pass credentials from process to subprocess.
The logic itself looks good; this mostly is just moving the existing (already-reviewed) code.
As part of moving this code to be used more broadly, as polish I'd also suggest this may be a good time to tighten up input variable checks, and perhaps think about code docs too. And a few other items along those lines down below - all just suggestions, pick and choose as you wish.
I like it, this is a good step in the right direction. It's not only cleaner, but probably safer since there won't be need to pass credentials from process to subprocess.
The logic itself looks good; this mostly is just moving the existing (already-reviewed) code.
As part of moving this code to be used more broadly, as polish I'd also suggest this may be a good time to tighten up input variable checks, and perhaps think about code docs too. And a few other items along those lines down below - all just suggestions, pick and choose as you wish.