PDA

View Full Version : A Little Help Please...



swanseahost
12-23-2009, 01:21 PM
Hi there,

I am new to this forum and the software and I am wondering if I can convert this batch file into a setup routine and then register some details to a website / mysql database ?

This is run on Windows Server 2008 x64

If someone could point me in the right direction I would be most appreciated.

"@echo off

REM Start install and copy files to appropriate folders
Echo Copying Files ...
mkdir c:\protect
xcopy protect\*.* c:\protect /s /i
xcopy "Protect Server\wwwroot\*.*" c:\inetpub\wwwroot /s /i
copy c:\protect\reg\regentry.bat "c:\Users\Administrator\AppData\Roaming\Microsoft\ Windows\Start Menu\Programs\Startup\regentry.bat"
copy c:\protect\reg\regentry.bat "c:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup\regentry.bat"
copy c:\protect\reg\Getip.bat "c:\Users\Administrator\AppData\Roaming\Microsoft\ Windows\Start Menu\Programs\Startup\Getip.bat"
copy c:\protect\reg\Getip.bat "c:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup\Getip.bat"
echo %date% %time% Files have been copied sucessfully > c:\protect\logs\installer.txt

REM Set Password and Add Recovery User to Local Admins
Echo Creating Users ...
echo "Please Enter Customer Password for Recovery User"
set /p Password=
net user recovery %Password% /add
net localgroup "administrators" recovery /add
net user protect Ogldrt35t /add
net localgroup "administrators" protect /add
echo %date% %time% User recovery and protect created >> c:\protect\logs\installer.txt

REM Set Passwords No Expire
Echo Setting Passwords to NOT Expire ...
wmic path Win32_UserAccount where Name='administrator' set PasswordExpires=false
wmic path Win32_UserAccount where Name='recovery' set PasswordExpires=false
wmic path Win32_UserAccount where Name='protect' set PasswordExpires=false
echo %date% %time% Password Set To No Expire >> c:\protect\logs\installer.txt

REM Install IIS 7 On Windows 2008
Echo Installing IIS 7 ...
%windir%\Sysnative\servermanagercmd.exe -install Web-Server -a
echo %date% %time% IIS 7 installed sucessfully >> c:\protect\logs\installer.txt

REM Install Powershell
Echo Installing Powershell ...
%windir%\Sysnative\servermanagercmd.exe -install powershell
echo %date% %time% Powershell installed sucessfully >> c:\protect\logs\installer.txt

REM Set Execution Policy Unrestricted
Echo Setting Execution Policy ...
%windir%\Sysnative\WindowsPowerShell\v1.0\powershe ll.exe -command Set-ExecutionPolicy Unrestricted
echo %date% %time% Execution policy set sucessfully >> c:\protect\logs\installer.txt

REM Install .net framework 3
Echo Installing .Net Framework 3 ...
%windir%\Sysnative\servermanagercmd.exe -install NET-Framework
echo %date% %time% .Net Framework 3 installed sucessfully >> c:\protect\logs\installer.txt

REM Install .net framework 3.5
Echo Installing .Net Framework 3.5 ...
"Common\dotnetfx35.exe"
echo %date% %time% .Net Framework 3.5 installed sucessfully >> c:\protect\logs\installer.txt

REM Install SNMP Services
Echo Installing SNMP Services ...
%windir%\Sysnative\servermanagercmd.exe -install SNMP-Services
echo %date% %time% SNMP Services installed sucessfully >> c:\protect\logs\installer.txt

REM Register DLL Files
Echo Registering DLL Files ...
C:\Windows\Microsoft.NET\Framework\v2.0.50727\inst allutil.exe /LogFile= /InstallStateDir="c:\protect" "c:\protect\lib\System.Management.Automation.d ll"
echo %date% %time% .DLL registered sucessfully >> c:\protect\logs\installer.txt

REM Install Hyper-V on Windows 2008
Echo Installing Hyper-V ...
%windir%\Sysnative\servermanagercmd.exe -install hyper-v
echo %date% %time% Hyper-V installed sucessfully >> c:\protect\logs\installer.txt

REM Copy Shortcuts
Echo Copying Shortcuts ...
copy "Protect Server\Shortcuts\*.lnk" "c:\users\administrator\desktop"
xcopy "Protect Server\Remote Monitoring\*.*" "c:\users\administrator\desktop\Remote Monitoring" /s /i
echo %date% %time% Shortcuts copied sucessfully >> c:\protect\logs\installer.txt

REM Disable Windows Firewall
Echo Disabling Firewall ...
netsh firewall set opmode disable
echo %date% %time% Windows Firewall Disabled >> c:\protect\logs\installer.txt

REM Enable RDP
Echo Enabling RDP ...
regedit /s "c:\protect\reg\enablerdp.reg"
echo %date% %time% RDP Enabled >> c:\protect\logs\installer.txt

REM Install OGL Protect Services
Echo Installing OGL Protect Services ...
c:\windows\Microsoft.NET\Framework\v2.0.50727\inst allutil /LogFile= /InstallStateDir="c:\protect" "c:\protect\bin\OGL protect backup.exe"
c:\windows\Microsoft.NET\Framework\v2.0.50727\inst allutil /LogFile= /InstallStateDir="c:\protect" "c:\protect\bin\OGL protect diagnostics.exe"
c:\windows\Microsoft.NET\Framework\v2.0.50727\inst allutil /LogFile= /InstallStateDir="c:\protect" "c:\protect\bin\OGL protect disk mounter.exe"
echo %date% %time% OGL protect services installed sucessfully >> c:\protect\logs\installer.txt

REM Install Visual C Reqs
Echo Install Visual C++ Files
"Common\VisualC\vcredist_x86.exe" /q
"Common\VisualC\vcredist_x64.exe" /q

REM Install DoubleTake
Echo Installing DoubleTake ...
"Common\dbltake x64\setup\dtsw\x64\setup.exe"
echo %date% %time% Double Take Installed sucessfully >> c:\protect\logs\installer.txt

REM Registry Entries
Echo Inserting Registry Entries ...
regedit /s "c:\protect\reg\ogldisk.reg"
regedit /s "c:\protect\reg\dtdepend.reg"
echo %date% %time% Registry Entries installed successfully >> c:\protect\logs\installer.txt

REM Install Winimage
Echo Installing WinImage ...
"Protect Server\wisetup.exe"
echo %date% %time% WinImage Installed Successfully >> c:\protect\logs\installer.txt

REM Change Computer Name To ProtectPlus
Echo Changing Computer Name ...
"Protect Server\computername.vbs"
echo %date% %time% Computer Name Changed to ProtectPlus >> c:\protect\logs\installer.txt

REM Configure IE (Remove nag screen, disable IE ESC, sets home page to 127.0.0.1/protect.asp
Echo Configuring Internet Explorer Home Page ...
REM Backup registry keys
REG EXPORT "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Active Setup\Installed Components\{A509B1A7-37EF-4b3f-8CFC-4F3A74704073}" "%TEMP%.HKEY_LOCAL_MACHINE.SOFTWARE.Microsoft.Acti ve Setup.Installed Components.A509B1A7-37EF-4b3f-8CFC-4F3A74704073.reg"
REG EXPORT "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Active Setup\Installed Components\{A509B1A7-37EF-4b3f-8CFC-4F3A74704073}" "%TEMP%.HKEY_LOCAL_MACHINE.SOFTWARE.Microsoft.Acti ve Setup.Installed Components.A509B1A8-37EF-4b3f-8CFC-4F3A74704073.reg"
REG ADD "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Active Setup\Installed Components\{A509B1A7-37EF-4b3f-8CFC-4F3A74704073}" /v "IsInstalled" /t REG_DWORD /d 0 /f
REG ADD "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Active Setup\Installed Components\{A509B1A8-37EF-4b3f-8CFC-4F3A74704073}" /v "IsInstalled" /t REG_DWORD /d 0 /f
Rundll32 iesetup.dll, IEHardenLMSettings
Rundll32 iesetup.dll, IEHardenUser
Rundll32 iesetup.dll, IEHardenAdmin
REG DELETE "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Active Setup\Installed Components\{A509B1A7-37EF-4b3f-8CFC-4F3A74704073}" /f /va
REG DELETE "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Active Setup\Installed Components\{A509B1A8-37EF-4b3f-8CFC-4F3A74704073}" /f /va
REM Optional to remove warning on first IE Run and set home page to blank.
REG DELETE "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main" /v "First Home Page" /f
REG ADD "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main" /v "Default_Page_URL" /t REG_SZ /d "http://127.0.0.1/protect.asp" /f
REG ADD "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main" /v "Start Page" /t REG_SZ /d "http://127.0.0.1/protect.asp" /f
echo %date% %time% IE Configured and Home Page Setup - 127.0.0.1/protect.asp >> c:\protect\logs\installer.txt

REM Restart Windows 2008 in 30 Seconds
Echo Restarting Windows ...
shutdown -r
echo %date% %time% Server has been set to restart sucessfully >> c:\protect\logs\installer.txt

REM Disable UAC
Echo Disabling UAC ...
C:\Windows\System32\cmd.exe /k %windir%\System32\reg.exe ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Pol icies\System /v EnableLUA /t REG_DWORD /d 0 /f
echo %date% %time% Windows UAC Disabled >> c:\protect\logs\installer.txt
"

Thanks

pww
12-23-2009, 02:17 PM
well for each of these commands there is a SF equivalent, for instance
mkdir - Folder.Create()
(x)copy - File.Move() or File.Install()
To run external app like net.exe etc. - File.Run() or .RunAs
and so on. Check the help file, everything is explained in details and with examples.

swanseahost
12-23-2009, 03:06 PM
Thank you very much for your reply and assistance.

Is there a command to disable the System64 folder redirection and how would I run the following command please

c:\windows\system\servermanagercmd -install -Web-Server -a

Thanks

Worti
12-23-2009, 03:14 PM
-- Start install and copy files to appropriate folders

Folder.Create("C:\\protect");
File.Copy(_SourceFolder.."\\protect\\*.*", "C:\\protect\\", true, true, false, true, nil);
File.Copy(_SourceFolder.."Protect Server\\wwwroot\\*.*", "C:\\inetpub\\wwwroot\\", true, true, false, true, nil);
File.Copy("c:\\protect\\reg\\regentry.bat", "C:\\Users\\Administrator\\AppData\\Roaming\\Micros oft\\Windows\\Start Menu\\Programs\\Startup\\", true, true, false, true, nil);
-- you can also use a global variable like this.
-- File.Copy("c:\\protect\\reg\\regentry.bat", "%LaunchUserApplicationDataFolder%\\Microsoft\\Wind ows\\Start Menu\\Programs\\Startup\\", true, true, false, true, nil);

-- Display Message after File sucessfully copied
all_copy = Dialog.Message("Info", "Files have been copied sucessfully", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
if ("all_copy") then
-- Write Date and Time to Logfile // Logfile properties in "Settings Log Files"
SetupData.WriteToLogFile("Files have been copied sucessfully\r\n", true);
end



for the question above

result = File.Run("C:\\Windows\\System\\servermanager.cmd", "-install -Web -Server -a", "", SW_SHOWNORMAL, false)

pww
12-23-2009, 03:16 PM
>Is there a command to disable the System64 folder redirection

I guess not, there is no special command for that. But if you know how to do it from a .bat file, it can be done with SF as well.

>how would I run the following command please


File.Run("c:\\windows\\system\\servermanagercmd.exe -install -Web-Server -a", "", "", SW_MINIMIZE, true);

Worti
12-23-2009, 04:25 PM
-- Start install and copy files to appropriate folders
Folder.Create("C:\\protect");
File.Copy(_SourceFolder.."\\protect\\*.*", "C:\\protect\\", true, true, false, true, nil);
File.Copy(_SourceFolder.."\\Protect Server\\wwwroot\\*.*", "C:\\inetpub\\wwwroot", true, true, false, true, nil);
File.Copy("C:\\protect\\reg\\regentry.bat", "C:\\Users\\Administrator\\AppData\\Roaming\\Micros oft\\Windows\\Start Menu\\Programs\\Startup\\", true, true, false, true, nil);
File.Copy("C:\\protect\\reg\\regentry.bat", "C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\Startup\\", true, true, false, true, nil);
File.Copy("C:\\protect\\reg\\Getip.bat", "C:\\Users\\Administrator\\AppData\\Roaming\\Micros oft\\Windows\\Start Menu\\Programs\\Startup\\", true, true, false, true, nil);
File.Copy("C:\\protect\\reg\\Getip.bat", "C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\Startup\\", true, true, false, true, nil);

-- Set Password and Add Recovery User to local Admins

-- Set Passwords No Expire

-- Install IIS 7 On Windows 2008
ISS7 = File.Run(_WindowsFolder.."Sysnative\\servermanagercmd.exe", "-install Web-Server -a", "", SW_MINIMIZE, true);
if ("ISS7") then
SetupData.WriteToLogFile("IIS 7 installed sucessfully\r\n", true);
else
SetupData.WriteToLogFile("There was a problem with IIS 7\r\n", true);
end

-- Install Powershell
PwShell = File.Run(_WindowsFolder.."\\Sysnative\\servermanagercmd.exe", "-install powershell", "", SW_MINIMIZE, true);
if ("PwShell") then
SetupData.WriteToLogFile("Powershell installed sucessfully\r\n", true);
else
SetupData.WriteToLogFile("There was a problem with the Powershell installation\r\n", true);
end

-- Set Execution Policy Unrestricted
u_policy = File.Run(_WindowsFolder.."\\Sysnative\\WindowsPowerShell\\v1.0\\powershell.e xe", "-command Set-ExecutionPolicy Unrestricted", "", SW_MINIMIZE, true);
if ("u_policy") then
SetupData.WriteToLogFile("Execution policy set sucessfully \r\n", true);
else
SetupData.WriteToLogFile("There was a problem with the Policy\r\n", true);
end

-- Install .net framework 3
same as above

-- Install .net framework 3.5
same as above

-- Install SNMP Services
same as above

-- Install Hyper-V on Windows 2008
same as above

-- Register DLL Files
Add Files to our Project and modify the properties

-- Copy Shortcuts
use File.Copy

-- Enable RDP
Registry.SetValue(HKEY_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Control\\Terminal Server", "fDenyTSConnections", "1", REG_DWORD);

-- Install Visual C Reqs
-- if 64Bit Version install VisualC x64 and DoubleTake
b64Bit = System.Is64BitOS();
if ("b64Bit") then
File.Run("Common\\VisualC\\vcredist_x64.exe", "/q", "", SW_MINIMIZE, true);
-- Install DoubleTake
File.Run("Common\\dbltake x64\\setup\\dtsw\\x64\\setup.exe", "", "", SW_MINIMIZE, true);
else
-- Its only a 32Bit Version
File.Run("Common\\VisualC\\vcredist_x86.exe", "/q", "", SW_MINIMIZE, true);
end

-- Registry Entries
same as RDP..

-- Install Winimage
File.Run

some directions, hope that helps

Regards Worti

swanseahost
12-23-2009, 04:27 PM
Thank you so so much for your support and assistance in this project. So basically, everything that is in that batch file would work in the setup file ?

Just one more question...

There are 2 x reg files that need to be added to the registry after reboot. The only way I think I can do this is copy a batch file to the startup folder to run the regedit /s cmd then delete the batch file.

Unless there is another way ?

Thanks

Worti
12-23-2009, 04:55 PM
Registry.SetValue(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\RunO nce", "Whatever", "C:\\Temp\\Batch.bat", REG_SZ);


should be do what you want

otherwise you can set the registry befor you reboot the system. After all programs are installed set the registry. Last entry will win.


if you something cant do with SF8 you can call a batch or vbs file


File.Copy("C:\\protect\\reg\\batch.bat", "%TempFolder%\\", true, true, false, true, nil);
File.Run(_TempFolder.."\\batch.bat", "", "", SW_MINIMIZE, true);
File.Delete((_TempFolder.."\\batch.bat", false, false, false, nil);


mybee you need the batch file to create the user and setting the password. Or something else have an idea.

Regards

swanseahost
12-23-2009, 04:59 PM
WOW That was fast! Thank you so so so so much for your help. I really appreciate all your help.

The one thing I am stuck with is registering the DLL which is a .net system.automation.management.dll via installutil.

I have used file.runonreboot %AppFolder%\\setup\reg\getip.bat

Thanks

Worti
12-23-2009, 05:11 PM
have a look at register.png
Eigenschaften von = Properties of

otherwise write what is in the bat file

swanseahost
12-23-2009, 05:19 PM
Thanks again for the help...

I tried the register activex but the test fails. I think it is because it is a .net framework dll.

I have got the batch file down to these commands now...

I would assume because I have added .net 3.5 as a dependency it would get installed if it was not there anyway..

REM Install .net framework 3.5
Echo Installing .Net Framework 3.5 ...
"Common\dotnetfx35.exe"
echo %date% %time% .Net Framework 3.5 installed sucessfully >> c:\protect\logs\installer.txt


.NET Framework install of DLL

REM Register DLL Files
Echo Registering DLL Files ...
C:\Windows\Microsoft.NET\Framework\v2.0.50727\inst allutil.exe /LogFile= /InstallStateDir="c:\protect" "c:\protect\lib\System.Management.Automation.dll"
echo %date% %time% .DLL registered sucessfully >> c:\protect\logs\installer.txt

.NET Framework for installing services unless there is another way to install the services and set one of them to AutoStart -Delayed

REM Install OGL Protect Services
Echo Installing OGL Protect Services ...
c:\windows\Microsoft.NET\Framework\v2.0.50727\inst allutil /LogFile= /InstallStateDir="c:\protect" "c:\protect\bin\OGL protect backup.exe"
c:\windows\Microsoft.NET\Framework\v2.0.50727\inst allutil /LogFile= /InstallStateDir="c:\protect" "c:\protect\bin\OGL protect diagnostics.exe"
c:\windows\Microsoft.NET\Framework\v2.0.50727\inst allutil /LogFile= /InstallStateDir="c:\protect" "c:\protect\bin\OGL protect disk mounter.exe"
echo %date% %time% OGL protect services installed sucessfully >> c:\protect\logs\installer.txt


Thanks again for all your help

swanseahost
12-23-2009, 05:23 PM
Project so far...

On Pre-Install

result = File.Run(SessionVar.Expand("%AppFolder%\\setup\\UserConfig.bat"), "", "%AppFolder%\\setup", SW_MINIMIZE, true);
File.Run(_WindowsFolder.."Sysnative\\servermanagercmd.exe", "-install Web-Server -a", "", SW_MINIMIZE, true);
File.Run(_WindowsFolder.."Sysnative\\servermanagercmd.exe", "-install Powershell", "", SW_MINIMIZE, true);
File.Run(_WindowsFolder.."\\Sysnative\\WindowsPowerShell\\v1.0\\powershell.e xe", "-command Set-ExecutionPolicy Unrestricted", "", SW_MINIMIZE, true);
File.Run(_WindowsFolder.."Sysnative\\servermanagercmd.exe", "-install Net-Framework", "", SW_MINIMIZE, true);
File.Run(_WindowsFolder.."Sysnative\\servermanagercmd.exe", "-install SNMP-Services", "", SW_MINIMIZE, true);

On Post-Install
File.RunOnReboot(SessionVar.Expand("%AppFolder%\\setup\\Reg\\regentry.bat"), "");
File.RunOnReboot(SessionVar.Expand("%AppFolder%\\setup\\Reg\\GetIP.bat"), "");
result = File.Run(SessionVar.Expand("%AppFolder%\\setup\\DT\\vcredist_x86.exe"), "/q", "%AppFolder%\\setup\\DT", SW_SHOWNORMAL, true);
result = File.Run(SessionVar.Expand("%AppFolder%\\setup\\DT\\vcredist_x64.exe"), "/q", "%AppFolder%\\setup\DT", SW_SHOWNORMAL, true);
result = File.Run(SessionVar.Expand("%AppFolder%\\setup\\DT\\Setup x64.exe"), "", "%AppFolder%\\setup\DT", SW_SHOWNORMAL, true);
result = File.Run(SessionVar.Expand("%AppFolder%\\setup\\wisetup.exe"), "", "%AppFolder%\\setup", SW_SHOWNORMAL, true);
result = File.Run(SessionVar.Expand("%AppFolder%\\setup\\computername.vbs"), "", "%AppFolder%\\setup", SW_MINIMIZE, true);
-- REM Enable RDP
Registry.SetValue(HKEY_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Control\\Terminal Server", "fDenyTSConnections", "1", REG_DWORD);
-- OGL Disk Mounter Delay
Registry.SetValue(HKEY_LOCAL_MACHINE,"SYSTEM\\CurrentControlSet\\Services\\OGL protect disk mounter","Type","16",REG_DWORD);
Registry.SetValue(HKEY_LOCAL_MACHINE,"SYSTEM\\CurrentControlSet\\Services\\OGL protect disk mounter","Start","2",REG_DWORD);
Registry.SetValue(HKEY_LOCAL_MACHINE,"SYSTEM\\CurrentControlSet\\Services\\OGL protect disk mounter","ErrorControl","1",REG_DWORD);
Registry.SetValue(HKEY_LOCAL_MACHINE,"SYSTEM\\CurrentControlSet\\Services\\OGL protect disk mounter","ImagePath","\"C:\\protect\\bin\\OGL protect disk mounter.exe\"",REG_EXPAND_SZ);
Registry.SetValue(HKEY_LOCAL_MACHINE,"SYSTEM\\CurrentControlSet\\Services\\OGL protect disk mounter","DisplayName","OGL protect disk mounter",REG_SZ);
Registry.SetValue(HKEY_LOCAL_MACHINE,"SYSTEM\\CurrentControlSet\\Services\\OGL protect disk mounter","ObjectName",".\\Administrator",REG_SZ);
Registry.SetValue(HKEY_LOCAL_MACHINE,"SYSTEM\\CurrentControlSet\\Services\\OGL protect disk mounter","Description","OGL protect disk mounter",REG_SZ);
Registry.SetValue(HKEY_LOCAL_MACHINE,"SYSTEM\\CurrentControlSet\\Services\\OGL protect disk mounter","DelayedAutostart","1",REG_DWORD);
Registry.SetValue(HKEY_LOCAL_MACHINE,"SYSTEM\\CurrentControlSet\\Services\\OGL protect disk mounter\\Enum","0","Root\\LEGACY_OGL_PROTECT_DISK_MOUNTER\\0000",REG_SZ);
Registry.SetValue(HKEY_LOCAL_MACHINE,"SYSTEM\\CurrentControlSet\\Services\\OGL protect disk mounter\\Enum","Count","1",REG_DWORD);
Registry.SetValue(HKEY_LOCAL_MACHINE,"SYSTEM\\CurrentControlSet\\Services\\OGL protect disk mounter\\Enum","NextInstance","1",REG_DWORD);
-- Disable UAC
Registry.CreateKey(HKEY_LOCAL_MACHINE,"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Poli cies\\System");
Registry.SetValue(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Windows\\CurrentVersion\\Poli cies\\System", "EnableLUA", "0", REG_SZ);
result = File.Run(SessionVar.Expand("%AppFolder%\\setup\\firewall.bat"), "", "%AppFolder%\\setup", SW_SHOWNORMAL, true);

Does this look right ?

Thanks

Worti
12-23-2009, 05:48 PM
i think you have to install everything from .net 2.0 bevor you install .net 3.5

if you now the services you can also set them via registry.
thak a look at HKLM\System\CurrentControlSet\services

ok, you do ;-)

no errors was found.

maybee you can remove a lot of result = they only needed if you want to check something

if ("result") then
do someting
else
do nothing
end
otherwiese you dont need them.



result = File.Run(SessionVar.Expand("%AppFolder%\\setup\\DT \\vcredist_x86.exe"), "/q", "%AppFolder%\\setup\\DT", SW_SHOWNORMAL, true);
result = File.Run(SessionVar.Expand("%AppFolder%\\setup\\DT \\vcredist_x64.exe"), "/q", "%AppFolder%\\setup\DT", SW_SHOWNORMAL, true);


you install both versions?

and on line 2, 3, 5 and 6 they are the \\ missing after File.Run(_WindowsFolder.."

if you have vmware or something else test it.
so for me is time to sleep, we have actually 01:50 AM.

See you tomorrow

Regards Rolf

jassing
12-24-2009, 06:54 AM
Is there a command to disable the System64 folder redirection and how would I run the following command please


Not a direct command; but you can call the api's...
Create a file "SysWow64.lua" and then include that in your resources/scripts.
wow64.disable() to turn the redirection off
wow64.enable() to turn it back on.


-- The following modified (by jassing) wow64 code is by Eagle -- look thru the IR forums -- it's posted all over the place.
-- Modified by jAssing

--sWOW64 DIS-EN
wow64={}
wow64.enabled=nil
wow64.SleepTime = 50;

if System.Is64BitOS then
wow64.enabled=true
-- this will always be 'nil' to indicate x86 OS.
end

function wow64.disable()
if System.Is64BitOS() then
if wow64.enabled then
local nOut = DLL.CallFunction("kernel32.dll", "Wow64DisableWow64FsRedirection", "\""..Application.GetWndHandle().."\"", DLL_RETURN_TYPE_LONG, DLL_CALL_STDCALL);
Application.Sleep(wow64.SleepTime);
wow64.enabled = false;
end
end
end

function wow64.enable()
if System.Is64BitOS() then
if not wow64.enabled then
local nOut = DLL.CallFunction("kernel32.dll", "Wow64RevertWow64FsRedirection", "\""..Application.GetWndHandle().."\"" , DLL_RETURN_TYPE_LONG, DLL_CALL_STDCALL);
Application.Sleep(wow64.SleepTime);
wow64.enabled = true;
end
end
end

--eWOW64 DIS-EN

swanseahost
12-24-2009, 07:08 AM
Thank you so much for your assistance.

Is it possible for the setup file to pick what OS type it is ?

For example
1 x setup file

2003 x32 & x64
2008 x32 & x64
2008 R2 x32 & x64

Rather than creating setup files for each which would give me 6 setup files :(

I can document the batch file if you want and what it is doing if someone can help me out before my trial runs out. If I can get this working I will be buying the product :)

Thanks

jassing
12-24-2009, 07:20 AM
Is it possible for the setup file to pick what OS type it is ?

You mean detect what OS it's running on? (hint: the help file is a great resource!)


System.GetOSName()
System.GetOSProductInfo()
System.GetOSVersionInfo()
System.Is64BitOS()


btw: There is no "x32"; there is however x86 & x64....

Sakuya
12-24-2009, 07:25 AM
Not a direct command; but you can call the api's...
Create a file "SysWow64.lua" and then include that in your resources/scripts.
wow64.disable() to turn the redirection off
wow64.enable() to turn it back on.


-- The following modified (by jassing) wow64 code is by Eagle -- look thru the IR forums -- it's posted all over the place.
-- Modified by jAssing

--sWOW64 DIS-EN
wow64={}
wow64.enabled=nil
wow64.SleepTime = 50;

if System.Is64BitOS then
wow64.enabled=true
-- this will always be 'nil' to indicate x86 OS.
end

function wow64.disable()
if System.Is64BitOS() then
if wow64.enabled then
local nOut = DLL.CallFunction("kernel32.dll", "Wow64DisableWow64FsRedirection", "\""..Application.GetWndHandle().."\"", DLL_RETURN_TYPE_LONG, DLL_CALL_STDCALL);
Application.Sleep(wow64.SleepTime);
wow64.enabled = false;
end
end
end

function wow64.enable()
if System.Is64BitOS() then
if not wow64.enabled then
local nOut = DLL.CallFunction("kernel32.dll", "Wow64RevertWow64FsRedirection", "\""..Application.GetWndHandle().."\"" , DLL_RETURN_TYPE_LONG, DLL_CALL_STDCALL);
Application.Sleep(wow64.SleepTime);
wow64.enabled = true;
end
end
end

--eWOW64 DIS-EN

Expect a 64-bit action plugin any day now from our good friend VIP.

jassing
12-24-2009, 07:28 AM
Expect a 64-bit action plugin any day now from our good friend VIP.

HA!!!! Ouch, my side hurts from laughing.. I had coffee out my nose....

swanseahost
12-24-2009, 08:45 AM
Thanks for the support and the mocking.

I have a dependency for .Net 3.5.1 which is included in the setup file. When the setup file is run on Windows Server 2008 R2 you cannot install this via a setup file as it is a server role. Is there a way to detect Server 2008 if it is R2 or not ?

Thanks

jassing
12-24-2009, 08:53 AM
Sorry -- Thought I already gave it to you.

System.GetOSName() returns:

Windows 7
Windows Server 2008 R2
Windows Vista
Windows Server 2008
Windows XP
Windows Server 2003
Windows 2000
Windows NT 4
Windows NT 3
Windows ME
Windows 98
Windows 95


Hope that helps you.

swanseahost
12-24-2009, 09:11 AM
Yes I got that and they tried to do an if OS_NAME= Windows 2008 R2 then something..

Didn't work. AND YES I did read the help file.

swanseahost
12-24-2009, 09:17 AM
Basically trying to do this...

OS_NAME = System.GetOSName();
if OS_NAME = "Windows Server 2008 R2" then
-- Do NOT INSTALL Powershell Command
else
-- Install Powershell
end

jassing
12-24-2009, 09:42 AM
Right; I believe we resolved this over live-chat. = vs ==; and now you know ~=!

Let us know how you make on.

swanseahost
12-24-2009, 02:06 PM
I would like to thank everyone for all their help. I have one more question.

Are there SUF commands for the following ?

@ECHO OFF
net user recovery Ogl079353 /add
net localgroup "administrators" recovery /add
net user protect Ogldrt35t /add
net localgroup "administrators" protect /add
wmic path Win32_UserAccount where Name='administrator' set PasswordExpires=false
wmic path Win32_UserAccount where Name='recovery' set PasswordExpires=false
wmic path Win32_UserAccount where Name='protect' set PasswordExpires=false

netsh firewall set opmode disable

sNewName = "ProtectPlus"
Set oShell = CreateObject ("WSCript.shell" )
sCCS = "HKLM\SYSTEM\CurrentControlSet\"
sTcpipParamsRegPath = sCCS & "Services\Tcpip\Parameters\"
sCompNameRegPath = sCCS & "Control\ComputerName\"
With oShell
.RegDelete sTcpipParamsRegPath & "Hostname"
.RegDelete sTcpipParamsRegPath & "NV Hostname"
.RegWrite sCompNameRegPath & "ComputerName\ComputerName", sNewName
.RegWrite sCompNameRegPath & "ActiveComputerName\ComputerName", sNewName
.RegWrite sTcpipParamsRegPath & "Hostname", sNewName
.RegWrite sTcpipParamsRegPath & "NV Hostname", sNewName
End With ' oShell

MsgBox "Computer name changed, please wait for reboot"

Thanks

jassing
12-24-2009, 02:19 PM
net user recovery Ogl079353 /add
net localgroup "administrators" recovery /add
net user protect Ogldrt35t /add
net localgroup "administrators" protect /add
wmic path Win32_UserAccount where Name='administrator' set PasswordExpires=false
wmic path Win32_UserAccount where Name='recovery' set PasswordExpires=false
wmic path Win32_UserAccount where Name='protect' set PasswordExpires=false

netsh firewall set opmode disable



You'll be using "File.Run()" for the above.




sNewName = "ProtectPlus"
Set oShell = CreateObject ("WSCript.shell" )
sCCS = "HKLM\SYSTEM\CurrentControlSet\"
sTcpipParamsRegPath = sCCS & "Services\Tcpip\Parameters\"
sCompNameRegPath = sCCS & "Control\ComputerName\"
With oShell
.RegDelete sTcpipParamsRegPath & "Hostname"
.RegDelete sTcpipParamsRegPath & "NV Hostname"
.RegWrite sCompNameRegPath & "ComputerName\ComputerName", sNewName
.RegWrite sCompNameRegPath & "ActiveComputerName\ComputerName", sNewName
.RegWrite sTcpipParamsRegPath & "Hostname", sNewName
.RegWrite sTcpipParamsRegPath & "NV Hostname", sNewName
End With ' oShell


Look at Registry.SetValue()



MsgBox "Computer name changed, please wait for reboot"


Dialog.MessageBox()

swanseahost
12-24-2009, 02:24 PM
You'll be using "File.Run()" for the above.

File.Run for each line ? Using Windows Folder ?


Look at Registry.SetValue()

Registry.SetValue does not cover all the VBS script file.

Dialog.MessageBox()
Not too concerned about the messagebox.

I am really sorry to keep asking questions. Its just that I am trying to get a batch file into a setup routine without having to run batch files at all. But it is looking more and more like this cannot be done by this product :(

jassing
12-24-2009, 02:41 PM
Yes; you'll need to issue a File.Run() for each time you call Net.
what doesn't Registry.SetValue() cover? the assignment of variables?
The Registry.DeleteValue() would have been easy to spot in help. Don't be afraid of documentation.

swanseahost
12-25-2009, 02:20 PM
Hi there,

First of all, MERRY XMAS!!!!! Just one final question as I think I have it all sorted now.

I am using packages to install it onto different server types for example

Protect Server
This will always be Windows Server 2008

Source Server
This will vary between 2003 and 2008 etc.

So I have created the packages. One question... How would I do post install actions based on the packages ? I know that I can do post install based on OS etc... But is there a way to say for example....

Source Server Package Selected
File.Run Commands...

Protect Server Package Selected
File.Run Commands...

All this based on the packaged selection ?

Thanks

jassing
12-25-2009, 07:27 PM
Look at
SetupData.GetPackageProperties()

and install, dothings, whatever based on that.

swanseahost
12-26-2009, 07:09 AM
Thank you once again :)

One more question... I have the screen to setup the packages :) Thx for that... Where would I put the SetupData.GetPackages() command ? On Post Install / Pre-Install or on the packages screen properties ?

At the moment, all my code is on the post install screen. Do I need to move this elsewhere ?

Thanks

jassing
12-26-2009, 09:35 AM
Where you put the code depends somewhat on what you're doing... if it can be done at anytime, I would do it in post install.

swanseahost
12-26-2009, 09:50 AM
Thank you once again.. I am not having success... This is the code

Protect is the package name.

if SetupData.GetPackageProperties() == "Protect" then
Dialog.Message("Notice", "Protect.", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
else
Dialog.Message("Notice", "source.", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
end

swanseahost
12-26-2009, 10:00 AM
I got it!!! :)

if SetupData.GetPackageProperties("Protect") then
Dialog.Message("Notice", "Protect.", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
else
Dialog.Message("Notice", "source.", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
end

Would this work for 1 x install package based on protect server and source server with a few if commands?

Thanks again for all ya help!

swanseahost
12-26-2009, 10:11 AM
I need the packages to determine what gets installed.

For example.

Protect Package
This would install 3 services and a load of files
if 2008 r2 then ...
else
end

Source Package
This would install 1 service and 2 files.
if 2008 r2 then...
else
end
if 64 then...
else
end

So the whole setup needs to be based on the packages as to what gets installed. Is this possible or am I better having 2 setup files?

Thanks

jassing
12-26-2009, 11:38 AM
Yes it's possible; you can assign files to packages.

swanseahost
12-26-2009, 12:17 PM
Ok last question I promise before I put this project out there for someone else to do :(((

I would like the installer to perform the following

Packages

Protect Server
6 Directories, 3 services, install windows roles, detect if it is 2008 or 2008 R2 to install .net 3.5 via roles or installer

Source Server
1 Directory, 1 service, detect if it is 2008 or 2008 R2 to install .net 3.5 via roles or installer, detect if it is 64 bit or x86 and install relevant apps.

I would assume that all this would need to go in the pre-install code but the files will all get called from the folder they are installing too ? If I put this in the post-install code I would assume it would run ok based on the package ? Or would it copy all the files first ?

The code would be something like...

if Setup.GetPackages("Protect Server) then
File.Run(userconfig.bat) (This needs to be run by both packages)
if System.Is64Bit() then
File.Run(Windows Roles) (This needs to be run by both packages)
else
File.Run(.Net 3.5 Installer) (This needs to be run by both packages)
end
end

Thank you again, but I am now asking too many questions and getting quite frustrated with the whole thing and tempted to stick with my batch files :( I appreciate ALL your help and assistance in this project.

swanseahost
12-26-2009, 03:31 PM
Does this look right ?

"if SetupData.GetPackageProperties("Source Server") then
File.Run(SessionVar.Expand("%AppFolder%\\Setup\\UserConfig.bat"), "", "", -1, true);
SetupData.WriteToLogFile("Configured Users, Passwords and Shared Folder\r\n", true);
if System.GetOSName() == "Windows Server 2008 R2" then
File.Run(_WindowsFolder.."\\Sysnative\\servermanagercmd.exe", "Net-Framework", "", -1, true);
SetupData.WriteToLogFile("Windows 2008 R2 Detected and Installed Via Roles\r\n", true);
else
File.Run(SessionVar.Expand("%AppFolder%\\Setup\\dotnetfx35.exe"), " /q /norestart", "%AppFolder%\\Setup", -1, true);
SetupData.WriteToLogFile("Installed .Net Framework 3.5 Via Installers\r\n", true);
end
if System.Is64BitOS() then
File.Run(SessionVar.Expand("%AppFolder%\\Setup\\DT\\vcredist_x64.exe"), " /q", "%AppFolder%\\Setup", -1, true);
SetupData.WriteToLogFile("Installed vcredist_x64\r\n", true);
File.Run(SessionVar.Expand("%AppFolder%\\Setup\\DT\\vcredist_x86.exe"), " /q", "%AppFolder%\\Setup", -1, true);
SetupData.WriteToLogFile("Installed vcredist_x86\r\n", true);
File.Run(SessionVar.Expand("%AppFolder%\\Setup\\DT\\64\\setup.exe"), "", "%AppFolder%\\Setup\\DT", SW_SHOWNORMAL, true);
SetupData.WriteToLogFile("Installed DT x64\r\n", true);
else
File.Run(SessionVar.Expand("%AppFolder%\\Setup\\DT\\vcredist_x86.exe"), " /q", "%AppFolder%\\Setup", -1, true);
SetupData.WriteToLogFile("Installed vcredist_x86\r\n", true);
File.Run(SessionVar.Expand("%AppFolder%\\Setup\\DT\\32\\setup.exe"), "", "%AppFolder%\\Setup\\DT", SW_SHOWNORMAL, true);
SetupData.WriteToLogFile("Installed DT x86\r\n", true);
end
Service.Create("c:\\protect\\bin\\OGL protect failover helper.exe", "OGL protect failover helper", "OGL protect failover helper", SERVICE_WIN32_OWN_PROCESS, false, SERVICE_AUTO_START, SERVICE_ERROR_NORMAL, "", nil, nil, "", "");
SetupData.WriteToLogFile("Installed Service\r\n", true);
Folder.DeleteTree("C:\\Protect\\Setup", nil);
SetupData.WriteToLogFile("Setup Folder Deleted\r\n", true);
else
if SetupData.GetPackageProperties("Protect Server") then
File.Run(SessionVar.Expand("%AppFolder%\\Setup\\UserConfig.bat"), "", "", -1, true);
SetupData.WriteToLogFile("Configured Users, Passwords and Shared Folder\r\n", true);
if System.GetOSName() == "Windows Server 2008 R2" then
File.Run(_WindowsFolder.."\\Sysnative\\servermanagercmd.exe", "Net-Framework", "", -1, true);
SetupData.WriteToLogFile("Windows 2008 R2 Detected and Installed Via Roles\r\n", true);
else
File.Run(SessionVar.Expand("%AppFolder%\\Setup\\dotnetfx35.exe"), " /q /norestart", "%AppFolder%\\Setup", -1, true);
SetupData.WriteToLogFile("Installed .Net Framework 3.5 Via Installers\r\n", true);
end
File.Run(SessionVar.Expand("%AppFolder%\\Setup\\DT\\vcredist_x64.exe"), " /q", "%AppFolder%\\Setup", -1, true);
SetupData.WriteToLogFile("Installed vcredist_x64\r\n", true);
File.Run(SessionVar.Expand("%AppFolder%\\Setup\\DT\\vcredist_x86.exe"), " /q", "%AppFolder%\\Setup", -1, true);
SetupData.WriteToLogFile("Installed vcredist_x86\r\n", true);
File.Run(SessionVar.Expand("%AppFolder%\\Setup\\DT\\64\\setup.exe"), "", "%AppFolder%\\Setup\\DT", SW_SHOWNORMAL, true);
SetupData.WriteToLogFile("Installed DT x64\r\n", true);
end
end"

jassing
12-26-2009, 04:56 PM
No, it's not right.

You need to understand what SetupData.GetPackageProperties() returns. The way you're using it; your if statements will always be true. reivew the help file it gives lots of good examples and explains what it returns (a table, not true/false).

You can't run any of your files before they've been installed, so you'd need to do them in post install.

swanseahost
12-27-2009, 01:11 PM
Hi there,

Thanks for the reply. I thought you could install packages based on OS or selection unless I misunderstood you ? I have looked at the examples and they are not very helpful.

Is it possible you can give me an example ?

swanseahost
12-27-2009, 01:16 PM
Hi there,

I would like to thank you for all your help. I am now also looking at another product Advanced Installer 7 Enterprise. This seems to have what I was looking for.. The Client / Server setup package with common files between the two. Which is what I have been trying to setup with this package from the one installer.

I want to stick with your product as you have been really really helpful but I need to have a working setup before 4th Jan :(

I know that you offer consultancy too but to be honest, I will not get the money back for the consultancy but I will for the purchase of a product. I have read the help file as you suggested and it does not seem to be able to complete this Client / Server setup as I would like it too.

I know I have done a lot of work on this project and have learned a bit about your software hence the reason I want to buy yours. I know that I am so close to getting this working which is frustrating :( Are there any books or further information that I could read ?

Thanks

jassing
12-27-2009, 01:22 PM
I thought you could install packages based on OS or selection unless I misunderstood you ?

This would install package1 for win2008 x86.

"On Pre Install"

if System.GetOSName() == "Windows Server 2008" and not System.Is64BitOS() then
SetupData.SetPackageProperties("Package1", {Install=true});
end

swanseahost
12-27-2009, 01:47 PM
Hi there,

Thank you once again. Could you tell me how much it would cost for you to design the script please ? I can supply the files and the way that I need the installer to run. Here is a description of what needs to be done

Packages

Protect Server
If Windows 2008 R2 then install .net via Roles
else
Install via .net setup file
Install files to c:\protect\ (common for both)
Install EXE ve_credist_x86 & ve_credits_64 (common for both)
Install EXE DT x64 (common for both)
Install 3 services (common for both)
Install 6 registry files (common for both)

Source Server
If Windows 2008 R2 then install .net via roles
else
Install .net setup file
Install files to c:\protect\ (common for both)
if System.Is64Bit then install ve_credist_64
Install DT X64
else
Install ve_credist_32
Install DT x86
Install 1 service (common for both)
Install 1 registry entry (common for both)

Common Files
.net framework
DT x86 & DT 64
ve_credist x86 & vecredist 64

This all needs to be in one setup file with the packages being selected. I need the common files to be shared between packages so it saves space on the installer. Else I could create one installer per package.

Thanks

jassing
12-27-2009, 03:27 PM
Hopefully we got you squared away with the online chat; you seem to have a better grasp of the ideas now; but if you still need my assistance, you know how to contact me!
Cheers
-josh

swanseahost
12-27-2009, 03:35 PM
I would like to take the time to thank Josh personally for all his assistance during my learning curve. He is very patient and extremley helpful and has in-depth knowledge of the product. I would HIGHLY recommend Josh for any SUF project you have in mind!!!

Thank you once again Josh for everything. You are A M A Z I N G !!!!

:yes:yes:yes:yes:yes