Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Install Software - RUNAS

 
Logged in as: Guest
arrSession:exec spGetSession 2,16,28117
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> Post a VBScript >> Install Software - RUNAS
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Install Software - RUNAS - 11/18/2005 1:08:10 AM   
  Gildo_BRAZIL


Posts: 1
Score: 0
Joined: 11/18/2005
Status: offline
On Error Resume Next
Const OverwriteExisting = True

Set objFSO = CreateObject("Scripting.FileSystemObject")
' Verifica de existe o arquivo em uma área compartilhada
If objFSO.FileExists("\\Servidor\Pasta\Arquivo.exe") Then
' Copia o arquivo para máquina do usuário
objFSO.CopyFile "\\Servidor\Pasta\Arquivo.exe" , "C:\Temp\Arquivo.exe", OverwriteExisting
' Executa a função para instalar o arquivo
Instala
Else
Wscript.Echo "Arquivo não está disponivel para instalação"
End If
Function Instala
Set WshShell = CreateObject("Wscript.Shell")
Set WshEnv = WshShell.Environment("PRocess")
WshShell.Run "runas.exe /user:" & "dominio\usuario" & " " & Chr(34) & "C:\TEMP\Arquivo.exe" & Chr(34)
Wscript.Sleep 800
WshShell.AppActivate WshEnv("SystemRoot") & "\system32\runas.exe"
Wscript.Sleep 200
WshShell.SendKeys "PASSWORD" & "~"
Wscript.Sleep 5000
Set WshShell = Nothing
Set WshEn = Nothing
End Function



Gildo Soares - Brazil - SP
http://www.microsoft.com/brasil/technet/default.mspx
http://www.microsoft.com/brasil/technet/Colunas/Gildo/BaselineSecurityAnalyzer.mspx
 
 
Post #: 1
 
 RE: Install Software - RUNAS - 4/10/2006 1:48:33 PM   
  rosado

 

Posts: 13
Score: 0
Joined: 4/8/2006
Status: offline
Muito Bom!

(in reply to Gildo_BRAZIL)
 
 
Post #: 2
 
 RE: Install Software - RUNAS - 4/10/2006 11:46:58 PM   
  DiGiTAL.SkReAM


Posts: 1171
Score: 7
Joined: 9/6/2005
From: Florida, USA
Status: offline
quote:

ORIGINAL: Gildo_BRAZIL
-----------------------------------------------------------------------------------------------------------------------------
On Error Resume Next
Const OverwriteExisting = True

Set objFSO = CreateObject("Scripting.FileSystemObject")
' Verifica de existe o arquivo em uma área compartilhada
If objFSO.FileExists("\\Servidor\Pasta\Arquivo.exe") Then
' Copia o arquivo para máquina do usuário
objFSO.CopyFile "\\Servidor\Pasta\Arquivo.exe" , "C:\Temp\Arquivo.exe", OverwriteExisting
' Executa a função para instalar o arquivo
Instala
Else
Wscript.Echo "Arquivo não está disponivel para instalação"
End If
Function Instala
Set WshShell = CreateObject("Wscript.Shell")
Set WshEnv = WshShell.Environment("PRocess")
WshShell.Run "runas.exe /user:" & "dominio\usuario" & " " & Chr(34) & "C:\TEMP\Arquivo.exe" & Chr(34)
Wscript.Sleep 800
WshShell.AppActivate WshEnv("SystemRoot") & "\system32\runas.exe"
Wscript.Sleep 200
WshShell.SendKeys "PASSWORD" & "~"
Wscript.Sleep 5000
Set WshShell = Nothing
Set WshEn = Nothing
End Function



Gildo Soares - Brazil - SP
http://www.microsoft.com/brasil/technet/default.mspx
http://www.microsoft.com/brasil/technet/Colunas/Gildo/BaselineSecurityAnalyzer.mspx

-----------------------------------------------------------------------------------------------------------------------------

First of all, Welcome!
Second, I took a look at your script posting and spent some time with babylon.com translating it into English.
Hopefully, I did ok as some of the words I ended up having to guess at.

Third, some comments on the script:

You use a function, and even thought it works, since a function should return some kind of value, what you should be using - strictly speaking - would be a Sub.
I would suggest removing the On Error Resume Next from the script.  This should only be used when required for error trapping, rather than all the time.
I'll post my 'translated' version of the code here for the other english-only speakers.


      

_____________________________

"Would you like to touch my monkey?" - Dieter (Mike Meyers)

"It is better to die like a tiger, than to live like a pussy."
-Master Wong, from Balls of Fury

(in reply to Gildo_BRAZIL)
 
 
Post #: 3
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> Post a VBScript >> Install Software - RUNAS Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts