Splunk doesn't have a built-in way to launch a script in another user context. I think generally the operating system's security model isn't going to provide any possible way for the "local system" user to transparently launch a process as a domain user. Maybe it's possible by drastically relaxing a lot of security guarantees -- I'm no windows expert -- but I wouldn't recommend that.
Here are some options:
Run splunk as a domain user with the right permissions. (Problem, this can be problematic with an indexer, since now all its files are owned differently. Fixing this can be as simple as changing ownership on all the files, and changing the user that the splunk services run as, but backups are appropriate for such experiments.)
Run your script externally to splunk, and write to log files that splunk tails. This has some nice properties of decoupling your code from splunk so it's easier to inspect, debug, etc. It also makes it much easier for you to always get complete data and never get duplicates. It has the additional burden of ensuring your code is running. Python's logger framework is a handy way to create the files.
... View more