From 8ce98ae22ca7b5e82bf9c062bfe06449d069f976 Mon Sep 17 00:00:00 2001 From: Bernardo Damele Date: Mon, 30 Jun 2014 20:43:02 +0100 Subject: [PATCH] more on issue #742 --- plugins/dbms/mssqlserver/filesystem.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/plugins/dbms/mssqlserver/filesystem.py b/plugins/dbms/mssqlserver/filesystem.py index 5bfd4cd5d..83b7faf64 100644 --- a/plugins/dbms/mssqlserver/filesystem.py +++ b/plugins/dbms/mssqlserver/filesystem.py @@ -179,7 +179,12 @@ class Filesystem(GenericFilesystem): self.xpCmdshellWriteFile(psString, tmpPath, randPSScript) logger.debug("executing the PowerShell script to write the %s file" % dFile) - self.execCmd("powershell -ExecutionPolicy ByPass -File \"%s\"" % randPSScriptPath) + + commands = ("powershell -ExecutionPolicy ByPass -File \"%s\"" % randPSScriptPath, + "del /F /Q \"%s\"" % (randPSScriptPath, randPSScriptPath)) + complComm = " & ".join(command for command in commands) + + self.execCmd(complComm) def _stackedWriteFileDebugExe(self, tmpPath, wFile, wFileContent, dFile, fileType): infoMsg = "using debug.exe to write the %s " % fileType @@ -224,7 +229,7 @@ class Filesystem(GenericFilesystem): debugMsg += "%s\%s to %s file %s\%s" % (tmpPath, chunkName, fileType, tmpPath, dFileName) logger.debug(debugMsg) - commands = ("cd \"%s\"" % tmpPath, copyCmd, "del /F %s" % chunkName) + commands = ("cd \"%s\"" % tmpPath, copyCmd, "del /F /Q %s" % chunkName) complComm = " & ".join(command for command in commands) self.execCmd(complComm)