Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion lib/instance_agent/platform/windows_util.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def self.delete_dirs_command(dirs_to_delete)
private
def self.delete_folder (dir)
if dir != nil && dir != "/"
output = `rd /s /q "#{dir}" 2>&1`
output = execute_ps_command("Remove-Item #{dir} -Recurse -Force 2>&1")
exit_status = $?.exitstatus
log(:debug, "Command status: #{$?}")
log(:debug, "Command output: #{output}")
Expand All @@ -88,6 +88,12 @@ def self.delete_folder (dir)
end
end

private
def self.execute_ps_command(ps_command)
exec_command = 'powershell.exe -ExecutionPolicy Bypass -Command ' + ps_command
exec_command
end

private
def self.execute_zip_command(cmd)
log(:debug, "Executing #{cmd}")
Expand Down