Python Forum
Problem executing a script on a remote host
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Problem executing a script on a remote host
#2
I found a different script online to 'remote' to a host. it is better.
import wmi, time
ip = 'xx.xx.xx.xxx'
username = "user"
password = "password!"
SW_SHOWNORMAL = 1
from socket import *
print ("Establishing connection to %s" %ip)
c = wmi.WMI(ip, user=username, password=password)
process_startup = c.Win32_ProcessStartup.new()
process_startup.ShowWindow = SW_SHOWNORMAL
process_id, result = c.Win32_Process.Create(CommandLine=r"C:\02\SubPrOc-Get-L_TESTING.py",ProcessStartupInformation=process_startup)
if result == 0:
  print ("Process started successfully: %d" % process_id)
else:
  print("Problem creating process: %d" % result)


it produces an error when trying to connect to a remote host:
'"Problem creating process: 8"
Reply


Messages In This Thread
RE: Problem executing a script on a remote host - by tester_V - Sep-24-2021, 06:26 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Triggering a ps1 script in remote windows server via http python request jasveerjassi 1 410 Jan-26-2024, 07:02 PM
Last Post: deanhystad
Question How can I import a variable from another script without executing it ThomasFab 12 7,928 May-06-2022, 03:21 PM
Last Post: bowlofred
  where to host my python script tomtom 1 1,287 Feb-09-2022, 06:45 AM
Last Post: ndc85430
  Script stop work after 3 actioins - PLEASE WHERE IS THE PROBLEM? rondon442 0 1,586 Sep-27-2021, 05:40 PM
Last Post: rondon442
  Failing to connect to a host with WMI tester_V 6 4,455 Aug-10-2021, 06:25 PM
Last Post: tester_V
  cant use ping, sudo or other commands in remote shell script. throwaway34 7 3,692 May-17-2021, 11:29 AM
Last Post: throwaway34
  problem with sphinx and file directory in script kiyoshi7 0 2,312 Mar-11-2021, 03:52 PM
Last Post: kiyoshi7
  problem about slope in python script for bitcoin trading fisher_garry 1 2,533 Sep-02-2020, 01:39 PM
Last Post: fisher_garry
  Problem running script within console koepjo 3 9,938 Mar-26-2020, 07:11 AM
Last Post: koepjo
  How to gather information from remote host using ansible module in python amritjsr 0 2,064 Jul-20-2019, 01:17 AM
Last Post: amritjsr

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020