Jump to content
Sign in to follow this  
nettech27

Can't figure out how to execute this command in AutoIT.

Recommended Posts

nettech27

I'm new to AutoIT and new to scripting so bare with me...I'm trying to write the results to a log file from running a setup.exe. My batch script works but I don't know how to take the same commands and run it in AutoIT. Is there anyone who can help me or point me in the right direction?

Here's my batch script:

rem @echo off

computername > "\\Myshare\Altiris\Logs\%computername%.log"

start "Altiris Agent Uninstall" /MIN /wait "C:\Program Files\Altiris\Altiris Agent\AeXAgentUtil.exe" /clean >> "\\Myshare\Altiris\Logs\uninstall_%computername%.log"

echo Altiris Agent Uninstalled on %computername% >> "\\Myshare\Altiris\Logs\uninstall_%computername%.log"

start "Altiris Agent Install" /MIN /wait "\\Myshare\Altiris\AeXNSC.exe" /install /ns=cms01.good.org /s >>

"\\Myshare\Altiris\Logs\re-installed_%computername%.log"

echo Altiris Agent installed on %computername% >> "\\Myshare\Altiris\Logs\%computername%.log"

Here's what I'm trying to do in AutoIT:

; ----------------------------------------------------------------------------------------------------------------------------------------------

; Stops Altiris Agent Process

If ProcessExists("AeXAgentUIHost.exe") Then

ProcessClose("AeXAgentUIHost.exe")

EndIf

If ProcessExists("AeXNSAgent.exe") Then

ProcessClose("AeXNSAgent.exe")

EndIf

; ----------------------------------------------------------------------------------------------------------------------------------------------

; Uninstalls Altiris SMA

RunWait("start ""Altiris Agent Uninstall""/MIN /wait ""C:\Program Files\Altiris\Altiris Agent\AeXAgentUtil.exe"" /clean /li ""\\Myshare\Altiris\uninstall_%computername%.log") - Can't get this part to work...even if I replace with: RunWait("C:\Program Files\Altiris\Altiris Agent\AexAgentUtil.exe"" /clean")

DirRemove("C:\Program Files\Altiris")

; ----------------------------------------------------------------------------------------------------------------------------------------------

; Installs Altiris SMA

RunWait(""\\Myshare\Altiris\AeXNSC.exe" /install /ns=cms01.good.org /s /li ""\\Myshare\Altiris\re-install_%computername%.log") - Can't get the log of the executable file.

; ----------------------------------------------------------------------------------------------------------------------------------------------

; End Script

Exit

Share this post


Link to post
Share on other sites
sleepydvdr

_FileWriteLog is probably what you want. You don't even need to create the log file first - it will do that for you. Here's an example:

#include <File.au3>
_FileWriteLog ("Mylog.log", "Step 1: Process Killed - " & @ComputerName)
Edited by sleepydvdr

#include <ByteMe.au3>

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×