DerekL Posted November 3, 2009 Share Posted November 3, 2009 Hi Guy's, I'm new to this site and scripting in general. I'm working on a project to deploy Windows 7 to users in my company sometime next year, we would like to automate it so that when we start a machine with a WinPE (3.0) USB stick, a window will open and allow the user to select a Site, for the purpose of mapping the correct distribution share, then browse to the correct .wim file, and image number. At this point we would like to be able to Name the computer, and join it to the domain with the correct username and password credentials, and also install the KBox agent for software deployment. I have a WinPE image with ImageX and GImageX installed and this works fine, is there anyway of building in the functionality we need, would be grateful of any pointers in the right direction. Cheers Derek Link to comment Share on other sites More sharing options...
crump Posted November 4, 2009 Share Posted November 4, 2009 Hi Guy's,I'm new to this site and scripting in general. I'm working on a project to deploy Windows 7 to users in my company sometime next year, we would like to automate it so that when we start a machine with a WinPE (3.0) USB stick, a window will open and allow the user to select a Site, for the purpose of mapping the correct distribution share, then browse to the correct .wim file, and image number. At this point we would like to be able to Name the computer, and join it to the domain with the correct username and password credentials, and also install the KBox agent for software deployment. I have a WinPE image with ImageX and GImageX installed and this works fine, is there anyway of building in the functionality we need, would be grateful of any pointers in the right direction.CheersDerekyes, it is possible.things you need:koda gui designer;autoit help file;autoit diskpart duf, or diskpart script;imagex Link to comment Share on other sites More sharing options...
DerekL Posted November 6, 2009 Author Share Posted November 6, 2009 Hi Guy's, Thanks for the advice Crump, so I have started a little work, and have designed a form with the functionality I would like, and have managed to get the Browse to a .wim file working, don't laugh I'm new to this Can anyone give me some help with how to extract the Image information from the .wim file to select an image, thanks in advance, my code is below. Regards DerekL #include <ButtonConstants.au3> #include <ComboConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <ProgressConstants.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Include <string.au3> #Include <Array.au3> #Include <GuiTreeView.au3> ; Script for the deployment of Windows 7 to Company Machines around the world ; This first part of the script was created automatically by the Koda Forms Designer ; This Form=c:\users\********\documents\winpe project\autoimage.kxf will be placed on the network share here ******* ADD SHARE LOCATION ********* Opt("GUIOnEventMode", 1) #Region ### START Koda GUI section ### Form=c:\users\********\documents\scripts\autoimage.kxf $Form1_1 = GUICreate("AutoImage 3.0 for Company A", 625, 536, 381, 198) GUISetBkColor(0xC0DCC0) GUISetOnEvent($GUI_EVENT_CLOSE, "Form1_1Close") GUISetOnEvent($GUI_EVENT_MINIMIZE, "Form1_1Minimize") GUISetOnEvent($GUI_EVENT_MAXIMIZE, "Form1_1Maximize") GUISetOnEvent($GUI_EVENT_RESTORE, "Form1_1Restore") $SelectWimLabel = GUICtrlCreateLabel("Select Wim File:", 56, 24, 117, 24) GUICtrlSetFont($SelectWimLabel, 12, 400, 0, "MS Sans Serif") GUICtrlSetOnEvent($SelectWimLabel, "SelectWimLabelClick") $SelectModelLabel = GUICtrlCreateLabel("Select Model:", 56, 64, 100, 24) GUICtrlSetFont($SelectModelLabel, 12, 400, 0, "MS Sans Serif") GUICtrlSetOnEvent($SelectModelLabel, "SelectModelLabelClick") $KBoxAgent = GUICtrlCreateRadio("Install KBox Agent", 56, 176, 169, 33) GUICtrlSetFont($KBoxAgent, 12, 400, 0, "MS Sans Serif") GUICtrlSetOnEvent($KBoxAgent, "KBoxAgentClick") $KeyboardLable = GUICtrlCreateLabel("Keyboard Layout:", 56, 104, 127, 24) GUICtrlSetFont($KeyboardLable, 12, 400, 0, "MS Sans Serif") GUICtrlSetOnEvent($KeyboardLable, "KeyboardLableClick") $Keyboard = GUICtrlCreateCombo("", 184, 104, 209, 25, BitOR($CBS_DROPDOWNLIST,$CBS_AUTOHSCROLL)) GUICtrlSetOnEvent($Keyboard, "KeyboardChange") $TimeZoneLabel = GUICtrlCreateLabel("Time Zone:", 56, 144, 83, 24) GUICtrlSetFont($TimeZoneLabel, 12, 400, 0, "MS Sans Serif") GUICtrlSetOnEvent($TimeZoneLabel, "TimeZoneLabelClick") $TimeZone = GUICtrlCreateCombo("", 184, 144, 209, 25, BitOR($CBS_DROPDOWNLIST,$CBS_AUTOHSCROLL)) GUICtrlSetOnEvent($TimeZone, "TimeZoneChange") $ImageButton = GUICtrlCreateButton("ImageButton", 48, 456, 89, 41, $WS_GROUP) GUICtrlSetOnEvent($ImageButton, "ImageButtonclick") $CaptureButton = GUICtrlCreateButton("Capture Image", 200, 456, 89, 41, $WS_GROUP) GUICtrlSetOnEvent($CaptureButton, "CaptureButtonclick") $MakeUSBButton = GUICtrlCreateButton("Make USB", 352, 456, 89, 41, $WS_GROUP) GUICtrlSetOnEvent($MakeUSBButton, "MakeUSBButtonclick") $CancelButton = GUICtrlCreateButton("Cancel", 496, 456, 89, 41, $WS_GROUP) GUICtrlSetOnEvent($CancelButton, "CancelButtonclick") $Progress1 = GUICtrlCreateProgress(88, 408, 449, 17) $ProgressLabel = GUICtrlCreateLabel("Progress:", 88, 376, 71, 24) GUICtrlSetFont($ProgressLabel, 12, 400, 0, "MS Sans Serif") GUICtrlSetOnEvent($ProgressLabel, "ProgressLabelClick") $ComputerNameLabel = GUICtrlCreateLabel("Computer Name:", 248, 184, 124, 24) GUICtrlSetFont($ComputerNameLabel, 12, 400, 0, "MS Sans Serif") GUICtrlSetOnEvent($ComputerNameLabel, "ComputerNameLabelClick") $ComputerName = GUICtrlCreateInput("ComputerName", 392, 184, 153, 21) GUICtrlSetOnEvent($ComputerName, "ComputerNameChange") $DomainNameLabel = GUICtrlCreateLabel("Domain:", 56, 224, 63, 24) GUICtrlSetFont($DomainNameLabel, 12, 400, 0, "MS Sans Serif") GUICtrlSetOnEvent($DomainNameLabel, "DomainNameLabelClick") $Domain = GUICtrlCreateCombo("", 160, 224, 193, 25, BitOR($CBS_DROPDOWNLIST,$CBS_AUTOHSCROLL)) GUICtrlSetOnEvent($Domain, "DomainChange") $UserNameLabel = GUICtrlCreateLabel("User Name:", 56, 264, 88, 24) GUICtrlSetFont($UserNameLabel, 12, 400, 0, "MS Sans Serif") GUICtrlSetOnEvent($UserNameLabel, "UserNameLabelClick") $UserName = GUICtrlCreateInput("UserName", 160, 264, 193, 21) GUICtrlSetOnEvent($UserName, "UserNameChange") $PassWordLabel = GUICtrlCreateLabel("Password:", 56, 304, 77, 24) GUICtrlSetFont($PassWordLabel, 12, 400, 0, "MS Sans Serif") GUICtrlSetOnEvent($PassWordLabel, "PassWordLabelClick") $Input2 = GUICtrlCreateInput("Password", 160, 304, 193, 21) GUICtrlSetOnEvent($Input2, "Input2Change") $DriveBrowse = GUICtrlCreateButton("Browse", 400, 24, 65, 25, $WS_GROUP) GUICtrlSetOnEvent($DriveBrowse, "DriveBrowseClick") $SuggestModelLabel = GUICtrlCreateLabel("Suggested Model:", 400, 105, 133, 24) GUICtrlSetFont($SuggestModelLabel, 12, 400, 0, "MS Sans Serif") GUICtrlSetOnEvent($SuggestModelLabel, "SuggestModelLabelClick") $ModelButton = GUICtrlCreateButton("Browse", 400, 61, 65, 25, $WS_GROUP) GUICtrlSetOnEvent($ModelButton, "ModelButtonclick") $wimfile = GUICtrlCreateInput("wimfile", 184, 24, 209, 21) GUICtrlSetOnEvent($wimfile, "wimfileChange") $model = GUICtrlCreateInput("model", 184, 64, 209, 21) GUICtrlSetOnEvent($model, "modelChange") $Icon1 = GUICtrlCreateIcon("C:\Windows\System32\imageres.dll", -83, 512, 16, 89, 81, BitOR($SS_NOTIFY,$WS_GROUP)) GUICtrlSetOnEvent($Icon1, "Icon1Click") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### ;Declare varibles here Dim $wimfile Dim $SelectedWim Dim $hApplySourceEdit Dim $STDERR_CHILD Dim $STDOUT_CHILD Dim $treeview ; Start of Main *************************************** While 1 Sleep(100) WEnd ; End of Main ***************************************** Func CancelButtonclick() Exit EndFunc Func CaptureButtonclick() EndFunc Func ComputerNameChange() EndFunc Func ComputerNameLabelClick() EndFunc Func DomainChange() EndFunc Func DomainNameLabelClick() EndFunc Func DriveBrowseClick() $SelectedWim = FileOpenDialog("Open wim file:", "X:\", "Image (*.wim)", 2) If @error Then MsgBox(4096,"","No File(s) chosen") Else $SelectedWim = StringReplace($SelectedWim, "|", @CRLF) MsgBox(4096,"","You chose " & $SelectedWim) GUICtrlSetData ($wimfile,$SelectedWim) EndIf EndFunc Func Form1_1Close() Exit EndFunc Func Form1_1Maximize() EndFunc Func Form1_1Minimize() EndFunc Func Form1_1Restore() EndFunc Func Icon1Click() EndFunc Func ImageButtonclick() EndFunc Func Input2Change() EndFunc Func KBoxAgentClick() EndFunc Func KeyboardChange() EndFunc Func KeyboardLableClick() EndFunc Func MakeUSBButtonclick() EndFunc Func ModelButtonclick() EndFunc Func modelChange() EndFunc Func PassWordLabelClick() EndFunc Func ProgressLabelClick() EndFunc Func SelectModelLabelClick() EndFunc Func SelectWimLabelClick() EndFunc Func SuggestModelLabelClick() EndFunc Func TimeZoneChange() EndFunc Func TimeZoneLabelClick() EndFunc Func UserNameChange() EndFunc Func UserNameLabelClick() EndFunc Func wimfileChange() EndFunc Func PollImage() EndFunc ;==>PollImage Link to comment Share on other sites More sharing options...
crump Posted November 7, 2009 Share Posted November 7, 2009 (edited) Hi DerekLGImagex has com interface that you can use with your code.for windows 7, download gimagex beta, and there is a help file with vb code, you should check that out.and also this COMRef will help you.to use it in autoit scripting is very easy also. just register the dll file with regsvr32[read help file]and then I can do this.$initWimCtrl = ObjCreate("GimageX.GimageXCtrl") $initWimCtrl.Source = "O:\WIMs\Windows_XP_New_Remake.wim" $initWimCtrl.ImageIndex = 1 $initWimCtrl.GetIMageInfo MsgBox(1,"",$initWimCtrl.ImageName)and just a reminder, in your code$SelectedWim = FileOpenDialog("Open wim file:", "X:\", "Image (*.wim)", 2)that "2" would probably not be working in pe3, at least not for me edit: Somehow I can't use GImageX v2.0.17 to work with above code, GImageX v2.0.16 BETA works fine, am I missing something? or it only works with AIK2 but not AIK3? Edited November 7, 2009 by crump Link to comment Share on other sites More sharing options...
DerekL Posted November 10, 2009 Author Share Posted November 10, 2009 Hi Crump, Thanks for that, yes the COM certainly does make life a little easier, when I get my application finished, will I have to ensure that the .dll is included in the WinPE build? Cheers DerekL Link to comment Share on other sites More sharing options...
crump Posted November 11, 2009 Share Posted November 11, 2009 Hi Crump,Thanks for that, yes the COM certainly does make life a little easier, when I get my application finished, will I have to ensure that the .dll is included in the WinPE build?CheersDerekLyes and you have to register it before using it. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now