Script Executes, but No Output Files Created

I am calling a cmdlet from an imported library. The cmdlet is recognized and runs as expected from the PowerShell ISE. This cmdlet splits a large text file into multiple text files. Specifically this is the Split-NAVApplicationObject command (https://msdn.microsoft.com/en-us/library/dn789718(v=nav.80).aspx)

When I call this command from a custom C# application (using PowerShell and Runspace classes) with the same arguments it runs, but does not produce and output files. I know that it is executing because it's a really large file and it take a while to finish. I don't get anything in the streams coming from PowerShell (only warnings and progress, no errors).

I have also tried creating a file with the New-Object cmdlet, and that works. So it's not some sort of permissions issue on the folder. I've confirmed I'm running as admin. I also tried piping the output of the command to a file in the folder where the other files should appear and that works (no data in the file even though I used -WhatIf).

Anyone have an idea of what I could do to figure this out?

June 22nd, 2015 11:58am

Are you using the full path to the files?

Free Windows Admin Tool Kit Click here and download it now
June 22nd, 2015 12:07pm

Yes, full path to all files, both for the imported library, and the large source file, and the destination folder.
June 22nd, 2015 12:14pm

Can  you decompose the CmdLet and run it is a basic script.  I cannot se the code so I  cannot be of much help.

Free Windows Admin Tool Kit Click here and download it now
June 22nd, 2015 12:22pm

Try adding PassThru and see what is in the returned FileInfo objects.
June 22nd, 2015 12:24pm

I'll see if I can decompose the script, will have to do some research. Using PassThru yields the same results. I can see each file get created and the standard things you would see when running from the ISE, but when I try to redirect to a file and call it from C# I get an empty file and no split files, just like with -WhatIf and none of the other optional arguments.
Free Windows Admin Tool Kit Click here and download it now
June 22nd, 2015 3:21pm

When you use "PassThru" it will return two objects. What is the content of those two objects?

June 22nd, 2015 4:32pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics