KiXforms Forum Index KiXforms
The Forum for the KiXforms Community
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 Quick Links 
Site News
Downloads
Documentation
Donations
Script Archive
Tracking Systems

RemoteExec() - Executes Remote (and local) commands
Goto page Previous  1, 2
 
Post new topic   Reply to topic    KiXforms Forum Index -> Script Archive
View previous topic :: View next topic  
Author Message
Radimus
KiXforms Enthusiast
KiXforms Enthusiast


Joined: 05 Mar 2003
Posts: 157
Location: Tampa, Florida

PostPosted: Tue Apr 11, 2006 5:36 pm    Post subject: Reply with quote

I modified his code a bit to make it fit in my app, but this works for me. I had some problems also, but it turned out to be varsinstrings

Code:

Function cmdRXExecute_Click()
   $frmMain.Mousepointer=11
   Select
      Case $optRXself.value=1
         $Connect = GetObject("winmgmts:{impersonationLevel=impersonate,(Debug)}!//"+$IPAddressBox.Text+"/root/cimv2:Win32_Process")
         $Process = $Connect.Create($txtRXcmd.Text)
      Case $optRXother.value=1
         $ID = $txtRXUser.caption
         $PW = $txtRXPW.caption
         If $ID="" or $ComputerNameBox.Text=@wksta
            If $ID=""
               $nul=MessageBox("A valid username and password are required to execute a remote command as another user.","Username and Password Required",16)
            Else
               $nul=MessageBox("You cannot use another account to execute commands on your local workstation. This is a limitation of SWbemLocator.","Username and Password Required",16)
            EndIf
         Else
            $Connect = CreateObject("WbemScripting.SWbemLocator")
            If $Connect<>""
               $EstCon = $Connect.ConnectServer($IPAddressBox.Text,"root\cimv2",$ID,$PW)
               If $EstCon<>""
                  $GrabProc = $EstCon.Get("Win32_Process")
                  If $GrabProc<>""
                     $Process = $GrabProc.Create($txtRXcmd.Text)
                  EndIf
               EndIf
            EndIf 
         EndIf
   EndSelect
   If @Error=0
      $lblRXLastA.Text="Last Command Status: Successful"
      $txtRxcmd.additem($txtRXcmd.Text)
   Else
      $lblRXLastA.Text="Last Command Status: Failed"
   EndIf
   $frmMain.Mousepointer=0
EndFunction
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
benny69
KiXforms Advocate
KiXforms Advocate


Joined: 30 Oct 2003
Posts: 567
Location: Lincoln, Ne

PostPosted: Tue Apr 11, 2006 7:01 pm    Post subject: Reply with quote

Rad,
you prolly know this but the link to sim does not seem to work, your prolly just working on it.

_________________
Wait don't order yet,... get KiXforms Designer .NET 2.0 (Beta)
KiXforms Designer .NET 2.0 (Beta)
Back to top
View user's profile Send private message Send e-mail
Radimus
KiXforms Enthusiast
KiXforms Enthusiast


Joined: 05 Mar 2003
Posts: 157
Location: Tampa, Florida

PostPosted: Tue Apr 11, 2006 7:51 pm    Post subject: Reply with quote

How very funny... it will not allow KIX files to dl, but has no prob with zip files...

Here is the same code zipped

http://kixtart.radprojects.net/files/
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
ntdoc
KiXforms Supporter
KiXforms Supporter


Joined: 05 Mar 2003
Posts: 77
Location: Mouse Country

PostPosted: Thu Apr 13, 2006 10:10 am    Post subject: Reply with quote

Maybe after I finish the Password Generator project and get a bit more free time I can start back up on the SIM project.
Back to top
View user's profile Send private message Visit poster's website AIM Address MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    KiXforms Forum Index -> Script Archive All times are GMT
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group