#89515 - 2002-11-14 09:22 PM
new project...
|
Radimus
Moderator
   
Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
|
how to remotely push an input box and return the entered value...
|
Top
|
|
|
|
#89517 - 2002-11-14 09:35 PM
Re: new project...
|
Radimus
Moderator
   
Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
|
Yep, that is what I would like...
|
Top
|
|
|
|
#89519 - 2002-11-14 09:45 PM
Re: new project...
|
Radimus
Moderator
   
Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
|
personally, I expect to have to do something like:
push a script to the remote pc remote exec it user enters the data remote script saves it to file
orig script does findproc() until remote script exits, then reads the remote file clean up of temp files.
kind of cumbersome... Looking for a better way
|
Top
|
|
|
|
#89520 - 2002-11-14 10:45 PM
Re: new project...
|
Chris S.
MM club member
   
Registered: 2002-03-18
Posts: 2368
Loc: Earth
|
I did this during a little experiment when I was trying to do a remote copy on a WMI-enable Win 95 box.
I copied this script to my target PC...
code:
break on ;setconsole("Hide")
If $SRC <> "" and $DST <> "" $MSG=GUICopy("Copy", "$SRC", "$DST", 1552) $nul = SENDMESSAGE($REQUESTOR,$MSG) Else $nul = SENDMESSAGE($REQUESTOR, "Please specify a source and destination") EndIf
function GUICopy($CMD, $Source, $Destination, OPTIONAL $Flags) If not $Flags $Flags=0 Endif If not exist($Source) $GUICopy = "Source does not exist." Exit (2) Endif If not exist($Destination) $GUICopy = "Destination does not exist." Exit (3) Endif If @INWIN=1 $VER=GETFILEVERSION(%WINDIR%+"\System32\Shell32.dll","FileVersion") Else $VER=GETFILEVERSION("%WINDIR%\System\Shell32.dll","FileVersion") Endif If $VER<"4.71" $GUICopy = "Cannot create namespace. Incorrect Shell32.dll version." Exit (4) Endif $objShell=CreateObject("Shell.Application") $objFolder=$objShell.NameSpace($Destination) Select Case $CMD="Copy" $objFolder.CopyHere($Source, $Flags) Case $CMD="Move" $objFolder.MoveHere($Source, $Flags) Case 1 $GUICopy = "GUICopy Syntax Incorrect. Use COPY or MOVE." $objShell=0 Exit (5) EndSelect $objShell=0 If @error = 0 $GUICopy = "$CMD Successful" else $GUICopy = "$CMD Failed" Endif Exit @error endfunction
And this ran it remotely using this script (please forgive the sloppiness of this code, as I have not finished it)...
code:
Break On
$RemoteBox = "TestPC" $ServerShr = "\\Server\share" $ID = "Domain\UserID" ; Use any account with local admin rights $PW = "XXXXXXX" ; Obvious security concerns $SRC = "\\Server\Share\Adobe.exe" $DST = "c:\windows\temp"
$CCommand = 'kix32.exe c:\remote_copy.kix $$src="$src" $$dst="$dst" $$requestor="@wksta"' $RCommand = "c:\windows\temp\adobe.exe"
$Connect = CreateObject("WbemScripting.SWbemLocator") If @ERROR @serror ? EndIf $Con2 = $Connect.ConnectServer("$remotebox","root\cimv2","$ID","$PW") If @ERROR @serror ? EndIf $Con2.Security_.ImpersonationLevel = 3 If @ERROR @serror ? EndIf $Con3 = $Con2.Get("Win32_Process") If @ERROR @serror ? EndIf $Map = $Con3.Create($CCommand) If @ERROR @serror ? EndIf ;sleep 10 $Con4 = $Con2.Get("Win32_Process") If @ERROR @serror ? EndIf ;sleep 5 $Process = $Con4.Create($RCommand) If @ERROR @serror ? EndIf
If NOT $Process ? "Process executed successfully!" Else ? "Process failed..." EndIf
$Connect="" $Process="" $Con2="" $Con3=""
|
Top
|
|
|
|
#89522 - 2002-11-19 01:42 PM
Re: new project...
|
Radimus
Moderator
   
Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
|
That wouldn't work if I sent the code out to 50 PCs at a time...
|
Top
|
|
|
|
#89523 - 2002-11-19 01:56 PM
Re: new project...
|
Kdyer
KiX Supporter
   
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
Rad,
Using the example of -
echo y | del .
Can't you do the same thing?
echo @userid | NET PROMPT \\REMOTE "Who is this?"
Kent
|
Top
|
|
|
|
#89526 - 2002-11-19 02:17 PM
Re: new project...
|
Radimus
Moderator
   
Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
|
all clients are win2k, so WMI is fine...
for the client to write to the registry on my PC, they would need admin (or equiv) on my box... not likely
I'd think that writeprofilestring to a common/networked ini file would be easiest [ 19. November 2002, 14:20: Message edited by: Radimus ]
|
Top
|
|
|
|
#89527 - 2002-11-19 02:23 PM
Re: new project...
|
Will Hetrick
Hey THIS is FUN
Registered: 2001-10-02
Posts: 320
Loc: Harrisburg, PA USA
|
This is what i use from your WMi query to the ini file.
code:
; Writes information to the an INI file ; Example: $Comp = CHECKREG($COMP,"MANUFACTURER") Function CHECKINI($VALUE,$WHERE) $ini = ReadProfileString($inifile,@wksta,"$where") If $ini = " " OR Len($ini) = 0 $ini = "N/A" EndIf If $Value = " " OR Len($Value) = 0 $Checkini = $ini $X = WriteProfileString($Inifile,@wksta,"$WHERE","$Checkini") Else $CHECKini = $VALUE $X = WriteProfileString($Inifile,@wksta,"$WHERE","$Checkini") EndIf Return EndFunction
_________________________
You have at least 2 choices. Each choice changes your destiny. Choose wisely!
|
Top
|
|
|
|
#89528 - 2002-11-19 02:26 PM
Re: new project...
|
Shawn
Administrator
   
Registered: 1999-08-13
Posts: 8611
|
Just green-lighting here.
Was thinking if you pushed this little vbs scriptlet to the target wkstn (to the root of c:\) ...
code:
dim ans
ans = InputBox("Hello")
This scriptlet could be changed to accept input parms to specify things like title and prompt, then ran this script from your machine:
code:
Break On $WKSTN = "tassie-xp" $Process = GetObject("winmgmts:{impersonationLevel=impersonate}!" + "\\$WKSTN\root\cimv2:Win32_Process" ) $Process.Create("wscript.exe c:\ibox.vbs") exit 1
Then maybe (like was just mentioned) use the registry or INI file to pipe back the reponse ...
|
Top
|
|
|
|
#89533 - 2002-11-19 05:32 PM
Re: new project...
|
Radimus
Moderator
   
Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
|
can vbscript output to a file or execute an external command?
|
Top
|
|
|
|
Moderator: Shawn, ShaneEP, Ruud van Velsen, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Mart
|
0 registered
and 194 anonymous users online.
|
|
|