Take the 2-minute tour ×

We have an application that we have instrumented with WMI, and have added a WMI method which is a ManagementTask. When we try to invoke this management task from another application the method is getting called just fine, however within that thread of execution we are trying to write to a file, send a command to the SCM, and perform debug logging. None of these three items will execute because they seem to be running into permissions problems.

When we try to write to a file we get the error


How do we resolve this?

share|improve this question

1 Answer 1

Al, I feel your pain. Any attempt to write to a file using native WMI methods will fail since WMI is not capable of doing it. However, there is a workaround created by Frank White using C#, which was fleshed out in VBS. Here's the line he created that does the magic:

InputParameters("CommandLine") = "cmd /c echo myFTPCommands > c:\ftpscript.txt"

Please refer to the VBS method for full description, and post back here if you have questions about it. And yes, you will need to set impersonationLevel, as shown in the VBS page.

For sending a command to the SCM, that shouldn't be a problem, so try it separately to ensure there's no issues. For debug logging, if you're writing a file to the remote system, then you'll have to use the workaround mentioned above.

share|improve this answer

Your Answer


