Sign in to follow this  
Followers 0
surreal

Display Info From Local & Remote PC (HELP)

12 posts in this topic

#1 ·  Posted (edited)

Pretty new to Autoit, i have built a few programs with it, but this will be one of my most complicated, for me that is.

I have used other tools like USMT, but they seem to be to bulky for my taste as well as to slow. As this grows i will be updating this description to better suit this program.

I apologize for my lack of coding so far, but working on these and everyone’s help, helps my learning curve so much. So please let me thank you all for your help in advance.

At this time I’m having issue with:

  • Computer Name "Target Machine" part. I don’t want it to turn green after the click on OK because

    the field was blank. Only Green if the ping was successful.

  • Cannot get the profiles to populate in the list.
I want this once I’m done to work on Vista and XP, but at this time the profile code is for Vista only "c:\users". The code at this time is also only for the local machine not the target.

Thank you again for looking at this code and in advance for your help.

#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <ProgressConstants.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <ComboConstants.au3>

Global $sTitle = 'MiGRatE WMA Pro'

;~ @OSServicePack - Returns one of the following: "SP1", "SP2", "SP3"
$SP = @OSServicePack
$SP = StringReplace($SP,"Service Pack 1","SP1")
$SP = StringReplace($SP,"Service Pack 2","SP2")
$SP = StringReplace($SP,"Service Pack 3","SP3")

;~ @OSVersion - Returns one of the following: "Windows Vista", "Windows XP", "Windows 2000", "Windows NT4"
$OS = @OSVersion
$OS = StringReplace($OS,"WIN_VISTA","Windows Vista "&$SP&"")
$OS = StringReplace($OS,"WIN_XP","Windows XP "&$SP&"")
$OS = StringReplace($OS,"WIN_2000","Windows 2000")
$OS = StringReplace($OS,"WIN_NT4","Windows NT4")

;~ GUI Images
$Migrate = GUICreate($sTitle, 618, 368, -1, -1)
$tHeader = GUICtrlCreatePic("bin\header.jpg", 106, 0, 513, 57, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
$lHeader = GUICtrlCreatePic("bin\surreal.jpg", 0, 0, 105, 369, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))

;~ GUI Title
$WMA = GUICtrlCreateLabel("  Workstation Migration Assistant", 130, 15, 300, 23)
    GUICtrlSetFont(-1, 17, 400, 0, "Impact")
    GUICtrlSetBkColor(-1, 0xFFFFFF)
$Version = GUICtrlCreateLabel("Version 1.4", 440, 30, 57, 17)
    GUICtrlSetFont(-1, 6, 400, 0, "")
    GUICtrlSetBkColor(-1, 0xFFFFFF)

;~ GUI Group System Information
$GroupSI = GUICtrlCreateGroup("System Information", 112, 64, 225, 81)
    GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$lbOS = GUICtrlCreateLabel("Operating System:", 120, 88, 90, 17)
$lbCN = GUICtrlCreateLabel("Computer Name:", 120, 104, 83, 17)
$lbAN = GUICtrlCreateLabel("Asset Number:", 120, 120, 73, 17)

$lpOS = GUICtrlCreateLabel($OS, 216, 88, 114, 17)
    GUICtrlSetColor(-1, 0x0000FF)
$lpCN = GUICtrlCreateLabel(@ComputerName, 216, 104, 114, 17)
    GUICtrlSetColor(-1, 0x0000FF)
$lpAN = GUICtrlCreateLabel("SURREAL", 216, 120, 114, 17)
    GUICtrlSetColor(-1, 0x0000FF)

;~ GUI Group Computer To Transfer From
$GroupTR = GUICtrlCreateGroup("Computer To Transfer From", 352, 64, 257, 81)
    GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$cnTarget = GUICtrlCreateInput("", 360, 88, 153, 21)
$btConnect = GUICtrlCreateButton("Connect", 520, 88, 75, 25, $WS_GROUP)
$txTR = GUICtrlCreateLabel("Enter Computer Name or IP Address.", 361, 120, 207, 17)

;~ GUI Group What To Migrate
$GroupMG = GUICtrlCreateGroup("What To Migrate", 112, 152, 281, 97)
    GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$lbDoc = GUICtrlCreateLabel("My Documents", 138, 177, 75, 17)
$cbDoc = GUICtrlCreateCheckbox("", 120, 176, 17, 17)
    GUICtrlSetState(-1, $GUI_CHECKED)
$lbAS400 = GUICtrlCreateLabel("AS400 Connections", 138, 193, 98, 17)
$cbAS400 = GUICtrlCreateCheckbox("", 120, 192, 17, 17)
    GUICtrlSetState(-1, $GUI_CHECKED)
$lbLN = GUICtrlCreateLabel("Lotus Notes", 138, 209, 61, 17)
$cbLN = GUICtrlCreateCheckbox("", 120, 208, 17, 17)
    GUICtrlSetState(-1, $GUI_CHECKED)
$lbIE = GUICtrlCreateLabel("Internet Explorer Favorites", 138, 225, 124, 17)
$cbIE = GUICtrlCreateCheckbox("", 120, 224, 17, 17)
    GUICtrlSetState(-1, $GUI_CHECKED)
$lbMD = GUICtrlCreateLabel("Mapped Drives", 305, 177, 76, 17)
$cbMD = GUICtrlCreateCheckbox("", 287, 176, 17, 17)
    GUICtrlSetState(-1, $GUI_CHECKED)
$lbPR = GUICtrlCreateLabel("Printers", 305, 193, 39, 17)
$cbPR = GUICtrlCreateCheckbox("", 287, 192, 17, 17)
$lbWP = GUICtrlCreateLabel("Wallpaper", 305, 209, 52, 17)
$cbWP = GUICtrlCreateCheckbox("", 287, 208, 17, 17)
    GUICtrlSetState(-1, $GUI_CHECKED)
$lbDP = GUICtrlCreateLabel("Desktop Profile", 305, 225, 87, 17)
$cbDP = GUICtrlCreateCheckbox("", 287, 224, 17, 17)
    GUICtrlSetState(-1, $GUI_CHECKED)

;~ GUI Group Profiles(s)
$GroupPF = GUICtrlCreateGroup("Profiles(s)", 408, 152, 201, 137)
    GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$ltPF = GUICtrlCreateList("", 475, 170, 121, 110)
$lbSA = GUICtrlCreateLabel("Select all:", 418, 176, 50, 17)
$rPFSA = GUICtrlCreateRadio("   ", 435, 192, 17, 17)
$btLoad = GUICtrlCreateButton("Load", 416, 235, 49, 25, $WS_GROUP)
    GUICtrlSetOnEvent(-1, "ProfileList")

;~ GUI Group Symantec Antivirus
$GroupSA = GUICtrlCreateGroup("Symantec Antivirus", 112, 256, 281, 65)
    GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$lbSAST = GUICtrlCreateLabel("State:", 120, 280, 32, 17)
$sCombo = GUICtrlCreateCombo("", 156, 280, 49, 25,BitOR($CBS_DROPDOWNLIST,$WS_VSCROLL))
    GUICtrlSetData(-1,"|CO|TX", "")
    GUISetState ()
$lbSACY = GUICtrlCreateLabel("City:", 220, 280, 24, 17)
$cCombo = GUICtrlCreateCombo("", 245, 280, 137, 25,BitOR($CBS_DROPDOWNLIST,$WS_VSCROLL))

;~ GUI Group Start, Stop, And Progress
$btStart = GUICtrlCreateButton("Start", 512, 296, 75, 25, $WS_GROUP)
$btStop = GUICtrlCreateButton("Stop", 424, 296, 75, 25, $WS_GROUP)
$Progress = GUICtrlCreateProgress(112, 336, 497, 17)
GUISetState(@SW_SHOW)

;~ Gathers the Dell Service Tag
$WbemFlagReturnImmediately = 0x10
$WbemFlagForwardOnly = 0x20
$ColItems = ""
$StrComputer = "localhost"
$ObjWMIService = ObjGet("winmgmts:\\" & $StrComputer & "\root\CIMV2")
$ColItems = $ObjWMIService.ExecQuery("SELECT * FROM Win32_ComputerSystemProduct", "WQL", $WbemFlagReturnImmediately + $WbemFlagForwardOnly)

If IsObj($ColItems) Then
        For $ObjInput In $ColItems
                GUICtrlSetData($lpAN,$objInput.IdentifyingNumber)
            Next
        EndIf

;~ GUI Exit
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit

;~ DropDown list for the Symantec State and City
Case $sCombo
        If GUICtrlRead($sCombo) = "CO" Then
                GUICtrlSetData($cCombo, "|295 Tech Center|Aspen|Broomfield|Colorado Springs|Delta|Dish Englewood|Englewood|Grand Junction|Greeley", "Broomfield")
        ElseIF GUICtrlRead($sCombo) = "TX" Then
                GUICtrlSetData($cCombo, "|Austin|Brentwood|Brownsville|Dallas|El Paso|Fort Worth|Hygeia Dairy|Laredo|Lubbock|McAllen|McKinney|Oak Farms|San Antonio|Schepps Dairy Dallas|Schepps Dairy Houston|Sulphur Springs|Waco", "Dallas")
        EndIf

;~ Computer Name Ping & Target Machine Messages
Case $btConnect
        If GUICtrlRead($cnTarget) = '' Then
                GUICtrlSetBkColor($cnTarget, '0xFF0000')
                    MsgBox(16, $sTitle, 'Target machine must be entered.')
        EndIf
        If Ping(GUICtrlRead($cnTarget)) Then
                GUICtrlSetBkColor($cnTarget, '0x66FF66')
        Else
                GUICtrlSetBkColor($cnTarget, '0xFF0000')
                    MsgBox(16, $sTitle, 'Target system could not be contacted, and may not be valid.')
        EndIf

;~ List Profile(s) In List
Func ProfileList()
    Local $plString = ""
$plList = _FileListToArray("C:\Users", "*", 2)
    For $i = 1 To $plList[0]
        Switch $plList[$i]
    Case "All Users", "Default User", "LocalService", "NetworkService", "Default", "Public"
                ContinueLoop
    Case Else
        If $i = $plList[0] Then
                $plString &= $plList[$i]
        Else
                $plString &= $plList[$i]&"|"
        EndIf
        EndSwitch
    Next
    GUICtrlSetData($ltPF, $plString)
EndFunc

EndSwitch
WEnd

Posted Image

Download Source (399 KB)

Edited by surreal

Share this post


Link to post
Share on other sites



For your info, under the What To Migrate section, the Internet Explorer Favorite, the "Favorite" is spelled wrongly. :D


JPGRARMouse Lock | My website | Thanks so much for your help! ❤️

Share this post


Link to post
Share on other sites

Thank you Crash, that has been corrected.

Share this post


Link to post
Share on other sites

Post all the code and highlight where you are having issues.

You might want search or have a look at MSDN to see how they do remote reg calls. Then might be able to use DLL calls to do the samething.


Post your code because code says more then your words can. SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y. Use Opt("MustDeclareVars", 1)[topic="84960"]Brett F's Learning To Script with AutoIt V3[/topic][topic="21048"]Valuater's AutoIt 1-2-3, Class... is now in Session[/topic]Contribution: [topic="87994"]Get SVN Rev Number[/topic], [topic="93527"]Control Handle under mouse[/topic], [topic="91966"]A Presentation using AutoIt[/topic], [topic="112756"]Log ConsoleWrite output in Scite[/topic]

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

below is the full code:

#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <ProgressConstants.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <ComboConstants.au3>

Global $sTitle = 'MiGRatE WMA Pro'

;~ @OSServicePack - Returns one of the following: "SP1", "SP2", "SP3"
$SP = @OSServicePack
$SP = StringReplace($SP,"Service Pack 1","SP1")
$SP = StringReplace($SP,"Service Pack 2","SP2")
$SP = StringReplace($SP,"Service Pack 3","SP3")

;~ @OSVersion - Returns one of the following: "Windows Vista", "Windows XP", "Windows 2000", "Windows NT4"
$OS = @OSVersion
$OS = StringReplace($OS,"WIN_VISTA","Windows Vista "&$SP&"")
$OS = StringReplace($OS,"WIN_XP","Windows XP "&$SP&"")
$OS = StringReplace($OS,"WIN_2000","Windows 2000")
$OS = StringReplace($OS,"WIN_NT4","Windows NT4")

;~ GUI Images
$Migrate = GUICreate($sTitle, 618, 368, -1, -1)
$tHeader = GUICtrlCreatePic("bin\header.jpg", 106, 0, 513, 57, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
$lHeader = GUICtrlCreatePic("bin\surreal.jpg", 0, 0, 105, 369, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))

;~ GUI Title
$WMA = GUICtrlCreateLabel("  Workstation Migration Assistant", 130, 15, 300, 23)
    GUICtrlSetFont(-1, 17, 400, 0, "Impact")
    GUICtrlSetBkColor(-1, 0xFFFFFF)
$Version = GUICtrlCreateLabel("Version 1.4", 440, 30, 57, 17)
    GUICtrlSetFont(-1, 6, 400, 0, "")
    GUICtrlSetBkColor(-1, 0xFFFFFF)

;~ GUI Group System Information
$GroupSI = GUICtrlCreateGroup("System Information", 112, 64, 225, 81)
    GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$lbOS = GUICtrlCreateLabel("Operating System:", 120, 88, 90, 17)
$lbCN = GUICtrlCreateLabel("Computer Name:", 120, 104, 83, 17)
$lbAN = GUICtrlCreateLabel("Asset Number:", 120, 120, 73, 17)

$lpOS = GUICtrlCreateLabel($OS, 216, 88, 114, 17)
    GUICtrlSetColor(-1, 0x0000FF)
$lpCN = GUICtrlCreateLabel(@ComputerName, 216, 104, 114, 17)
    GUICtrlSetColor(-1, 0x0000FF)
$lpAN = GUICtrlCreateLabel("SURREAL", 216, 120, 114, 17)
    GUICtrlSetColor(-1, 0x0000FF)

;~ GUI Group Computer To Transfer From
$GroupTR = GUICtrlCreateGroup("Computer To Transfer From", 352, 64, 257, 81)
    GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$cnTarget = GUICtrlCreateInput("", 360, 88, 153, 21)
$btConnect = GUICtrlCreateButton("Connect", 520, 88, 75, 25, $WS_GROUP)
$txTR = GUICtrlCreateLabel("Enter Computer Name or IP Address.", 361, 120, 207, 17)

;~ GUI Group What To Migrate
$GroupMG = GUICtrlCreateGroup("What To Migrate", 112, 152, 281, 97)
    GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$lbDoc = GUICtrlCreateLabel("My Documents", 138, 177, 75, 17)
$cbDoc = GUICtrlCreateCheckbox("", 120, 176, 17, 17)
    GUICtrlSetState(-1, $GUI_CHECKED)
$lbAS400 = GUICtrlCreateLabel("AS400 Connections", 138, 193, 98, 17)
$cbAS400 = GUICtrlCreateCheckbox("", 120, 192, 17, 17)
    GUICtrlSetState(-1, $GUI_CHECKED)
$lbLN = GUICtrlCreateLabel("Lotus Notes", 138, 209, 61, 17)
$cbLN = GUICtrlCreateCheckbox("", 120, 208, 17, 17)
    GUICtrlSetState(-1, $GUI_CHECKED)
$lbIE = GUICtrlCreateLabel("Internet Explorer Favorites", 138, 225, 124, 17)
$cbIE = GUICtrlCreateCheckbox("", 120, 224, 17, 17)
    GUICtrlSetState(-1, $GUI_CHECKED)
$lbMD = GUICtrlCreateLabel("Mapped Drives", 305, 177, 76, 17)
$cbMD = GUICtrlCreateCheckbox("", 287, 176, 17, 17)
    GUICtrlSetState(-1, $GUI_CHECKED)
$lbPR = GUICtrlCreateLabel("Printers", 305, 193, 39, 17)
$cbPR = GUICtrlCreateCheckbox("", 287, 192, 17, 17)
$lbWP = GUICtrlCreateLabel("Wallpaper", 305, 209, 52, 17)
$cbWP = GUICtrlCreateCheckbox("", 287, 208, 17, 17)
    GUICtrlSetState(-1, $GUI_CHECKED)
$lbDP = GUICtrlCreateLabel("Desktop Profile", 305, 225, 87, 17)
$cbDP = GUICtrlCreateCheckbox("", 287, 224, 17, 17)
    GUICtrlSetState(-1, $GUI_CHECKED)

;~ GUI Group Profiles(s)
$GroupPF = GUICtrlCreateGroup("Profiles(s)", 408, 152, 201, 137)
    GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$ltPF = GUICtrlCreateList("", 475, 170, 121, 110)
$lbSA = GUICtrlCreateLabel("Select all:", 418, 176, 50, 17)
$rPFSA = GUICtrlCreateRadio("   ", 435, 192, 17, 17)
$btLoad = GUICtrlCreateButton("Load", 416, 235, 49, 25, $WS_GROUP)
    GUICtrlSetOnEvent(-1, "ProfileList")

;~ GUI Group Symantec Antivirus
$GroupSA = GUICtrlCreateGroup("Symantec Antivirus", 112, 256, 281, 65)
    GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$lbSAST = GUICtrlCreateLabel("State:", 120, 280, 32, 17)
$sCombo = GUICtrlCreateCombo("", 156, 280, 49, 25,BitOR($CBS_DROPDOWNLIST,$WS_VSCROLL))
    GUICtrlSetData(-1,"|CO|TX", "")
    GUISetState ()
$lbSACY = GUICtrlCreateLabel("City:", 220, 280, 24, 17)
$cCombo = GUICtrlCreateCombo("", 245, 280, 137, 25,BitOR($CBS_DROPDOWNLIST,$WS_VSCROLL))

;~ GUI Group Start, Stop, And Progress
$btStart = GUICtrlCreateButton("Start", 512, 296, 75, 25, $WS_GROUP)
$btStop = GUICtrlCreateButton("Stop", 424, 296, 75, 25, $WS_GROUP)
$Progress = GUICtrlCreateProgress(112, 336, 497, 17)
GUISetState(@SW_SHOW)

;~ Gathers the Dell Service Tag
$WbemFlagReturnImmediately = 0x10
$WbemFlagForwardOnly = 0x20
$ColItems = ""
$StrComputer = "localhost"
$ObjWMIService = ObjGet("winmgmts:\\" & $StrComputer & "\root\CIMV2")
$ColItems = $ObjWMIService.ExecQuery("SELECT * FROM Win32_ComputerSystemProduct", "WQL", $WbemFlagReturnImmediately + $WbemFlagForwardOnly)

If IsObj($ColItems) Then
        For $ObjInput In $ColItems
                GUICtrlSetData($lpAN,$objInput.IdentifyingNumber)
            Next
        EndIf

;~ GUI Exit
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit

;~ Gather Information through WMI For Remote Computer
$colComputer, $TargetComputer = $cnTarget
$objWMIService = ObjGet("winmgmts:{impersonationLevel=Impersonate}!\\" & $TargetComputer & "\root\cimv2")
$colComputer = $objWMIService.ExecQuery("SELECT * from Win32_ComputerSystem")
For $objComputer in $colComputer
    Next

;~ DropDown list for the Symantec State and City
Case $sCombo
        If GUICtrlRead($sCombo) = "CO" Then
                GUICtrlSetData($cCombo, "|295 Tech Center|Aspen|Broomfield|Colorado Springs|Delta|Dish Englewood|Englewood|Grand Junction|Greeley", "Broomfield")
        ElseIF GUICtrlRead($sCombo) = "TX" Then
                GUICtrlSetData($cCombo, "|Austin|Brentwood|Brownsville|Dallas|El Paso|Fort Worth|Hygeia Dairy|Laredo|Lubbock|McAllen|McKinney|Oak Farms|San Antonio|Schepps Dairy Dallas|Schepps Dairy Houston|Sulphur Springs|Waco", "Dallas")
        EndIf

;~ Computer Name Ping & Target Machine Messages
Case $btConnect
        If GUICtrlRead($cnTarget) = '' Then
                GUICtrlSetBkColor($cnTarget, '0xFF0000')
                    MsgBox(16, $sTitle, 'Target machine must be entered.')
        EndIf
        If Ping(GUICtrlRead($cnTarget)) Then
                    MsgBox(0, $sTitle, "Operating System:  " & $OS & @LF & "Computer Name:  " & $objComputer.Name & @LF & "Asset Number:  " & $objInput.IdentifyingNumber)
                GUICtrlSetBkColor($cnTarget, '0x66FF66')
        Else
                    MsgBox(16, $sTitle, 'Target system could not be contacted, and may not be valid.')
                GUICtrlSetBkColor($cnTarget, '0xFF0000')
        EndIf

;~ List Profile(s) In List
Func ProfileList()
    Local $plString = ""
$plList = _FileListToArray("C:\Users", "*", 2)
    For $i = 1 To $plList[0]
        Switch $plList[$i]
    Case "All Users", "Default User", "LocalService", "NetworkService", "Public"
                ContinueLoop
    Case Else
        If $i = $plList[0] Then
                $plString &= $plList[$i]
        Else
                $plString &= $plList[$i]&"|"
        EndIf
        EndSwitch
    Next
    GUICtrlSetData($ltPF, $plString)
EndFunc

EndSwitch
WEnd

it will not let me highlight the code with the [autoit ] [/autoit ]

below are the issue(s), thank you very much for your help and looking into this.

grabbing the computername from the remote system to place into msg:

;~ Gather Information through WMI For Remote Computer
$colComputer, $TargetComputer = $cnTarget
$objWMIService = ObjGet("winmgmts:{impersonationLevel=Impersonate}!\\" & $TargetComputer & "\root\cimv2")
$colComputer = $objWMIService.ExecQuery("SELECT * from Win32_ComputerSystem")
For $objComputer in $colComputer
    Next

;~ Computer Name Ping & Target Machine Messages
Case $btConnect
        If GUICtrlRead($cnTarget) = '' Then
                GUICtrlSetBkColor($cnTarget, '0xFF0000')
                    MsgBox(16, $sTitle, 'Target machine must be entered.')
        EndIf
        If Ping(GUICtrlRead($cnTarget)) Then
                    MsgBox(0, $sTitle, "Operating System:  " & $OS & @LF & "Computer Name:  " & $objComputer.Name & @LF & "Asset Number:  " & $objInput.IdentifyingNumber)
                GUICtrlSetBkColor($cnTarget, '0x66FF66')
        Else
                    MsgBox(16, $sTitle, 'Target system could not be contacted, and may not be valid.')
                GUICtrlSetBkColor($cnTarget, '0xFF0000')
        EndIf

adding the profiles from the remote system into the listbox once a user clicks on load.

at this time the code is set for localhost account on a vista machine, i cant even get that to populate. once it works though i didnt think it would be hard to change the code to remote system.

;~ GUI Group Profiles(s)
$GroupPF = GUICtrlCreateGroup("Profiles(s)", 408, 152, 201, 137)
    GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$ltPF = GUICtrlCreateList("", 475, 170, 121, 110)
$lbSA = GUICtrlCreateLabel("Select all:", 418, 176, 50, 17)
$rPFSA = GUICtrlCreateRadio("   ", 435, 192, 17, 17)
$btLoad = GUICtrlCreateButton("Load", 416, 235, 49, 25, $WS_GROUP)
    GUICtrlSetOnEvent(-1, "ProfileList")

;~ List Profile(s) In List
Func ProfileList()
    Local $plString = ""
$plList = _FileListToArray("C:\Users", "*", 2)
    For $i = 1 To $plList[0]
        Switch $plList[$i]
    Case "All Users", "Default User", "LocalService", "NetworkService", "Public"
                ContinueLoop
    Case Else
        If $i = $plList[0] Then
                $plString &= $plList[$i]
        Else
                $plString &= $plList[$i]&"|"
        EndIf
        EndSwitch
    Next
    GUICtrlSetData($ltPF, $plString)
EndFunc

im thinking for the remote computer info that i need, my problems is that im also pulling info with wmi for localhost. if this is the case im not sure how to grab both separately. im pulling info with wmi from localhost for local dellasset. so im already using $strComputer for localhost.

and for why the profiles code is not populating im not sure, i can get it working within a dropdown for localhost, just not within a listbox. finial goal is to get it to populate within the listbox for the remote pc. im sure it is a stupid error on my part.

thanks again everyone for your help.

Edited by surreal

Share this post


Link to post
Share on other sites

Add AutoItSetOption("MustDeclareVars", 1) its good practice.

Make sure $btConnect is being set correctly. Use ConsoleWrite to or #AutoIt3Wrapper_Run_Debug_Mode=Y to ensure your script is running the way you expect it to.


Post your code because code says more then your words can. SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y. Use Opt("MustDeclareVars", 1)[topic="84960"]Brett F's Learning To Script with AutoIt V3[/topic][topic="21048"]Valuater's AutoIt 1-2-3, Class... is now in Session[/topic]Contribution: [topic="87994"]Get SVN Rev Number[/topic], [topic="93527"]Control Handle under mouse[/topic], [topic="91966"]A Presentation using AutoIt[/topic], [topic="112756"]Log ConsoleWrite output in Scite[/topic]

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Add AutoItSetOption("MustDeclareVars", 1) its good practice.

Make sure $btConnect is being set correctly. Use ConsoleWrite to or #AutoIt3Wrapper_Run_Debug_Mode=Y to ensure your script is running the way you expect it to.

thanks again, very much for the post bo8ster.

i read the help file on "AutoItSetOption ( "option" [, param] )" but im not sure where to add it. im not positive that $btConnect is working like i want it, but it does ping and send a message if i just use a local variable not one of the functions. im not even sure if doing this with functions is the correct way seeing that i will need dell service tag for both local and remote hosts.

i added the #AutoIt3Wrapper_Run_Debug_Mode=Y it didnt find anything however i am getting the following error message now on the smaller script above.

Posted Image

thanks again everyone in advance for your help with this. i have been working on this for about 3 to 4 weeks, tried to get as far as i could before posting. lol, i know i may have not have gotten as far as i should, in this amount of time, lol.

Edited by surreal

Share this post


Link to post
Share on other sites

thanks again, very much for the post bo8ster.

i read the help file on "AutoItSetOption ( "option" [, param] )" but im not sure where to add it. im not positive that $btConnect is working like i want it, but it does ping and send a message if i just use a local variable not one of the functions. im not even sure if doing this with functions is the correct way seeing that i will need dell service tag for both local and remote hosts.

i added the #AutoIt3Wrapper_Run_Debug_Mode=Y it didnt find anything however i am getting the following error message now on the smaller script above.

Posted Image

thanks again everyone in advance for your help with this. i have been working on this for about 3 to 4 weeks, tried to get as far as i could before posting. lol, i know i may have not have gotten as far as i should, in this amount of time, lol.

Hi, the error means that the $oWMI = ObjGet("winmgmts:{impersonationLevel=impersonate}!\\" & $strComputer & "\root\cimv2") failed to get the object.

Maybe do IsObj($oWMI) check after calling it before continuing the query..

Cheers

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

Hi, sorry I don't have an answer.

I really think you need to step through your code 1 step at a time and declare your variables before using them.

eg: $DNSHostName, $IPAddress, $UserName

Your doing a for loop and in the loop your using these variables..

But outside the loop the variables haven't been declared.

So after the for loop when you call the variable to retrieve it's data you'll get an error.

I know this isn't going to fix your connection problem, but it's just one less thing to battle with when your debugging your code.

Another thing I notice, is $objWMI process your using to get the DNS/IP is it supported by vista and onwards?

The reason I ask i was looking at Tech Net at a Wins/DNS script that pretty much uses the same method,

but when I looked at the platforms it supported it said winxp/2000 and No to any later version OS.

(I really can't see why it wouldn't work on a later version OS)

I use Tech Net to find most those wmi scripts I use, I just convert em to autoit format when I need a function.

Tech Net Script Center

Cheers.

Edit: I know this has nothing to do with your problem..

But this was what I used for the local info of a pc at one stage.

#include <Array.au3>

$aLG = WMI_ListLocalGroups()
_ArrayDisplay($aLG, "WMI_ListLocalGroups")
Func WMI_ListLocalGroups()
    Local $aInfo = StringSplit("AccountType|Caption|Description|Disabled|Domain|FullName|LocalAccount|Lockout|" & _
                                "Name|PasswordChangeable|PasswordExpires|PasswordRequired|SID|SIDType|Status", "|")

    Dim $aRet[1][16]
    For $i = 1 To $aInfo[0]
        $aRet[0][$i] = $aInfo[$i]
    Next
    Local $objWMIService, $colItems
    $objWMIService = ObjGet("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
    $colItems = $objWMIService.ExecQuery("Select * from Win32_UserAccount Where LocalAccount = True")

    For $objItem in $colItems
        $aRet[0][0] += 1
        Redim $aRet[$aRet[0][0] + 1][16]
        $aRet[$aRet[0][0]][1] = $objItem.AccountType
        $aRet[$aRet[0][0]][2] = $objItem.Caption
        $aRet[$aRet[0][0]][3] = $objItem.Description
        $aRet[$aRet[0][0]][4] = $objItem.Disabled
        $aRet[$aRet[0][0]][5] = $objItem.Domain
        $aRet[$aRet[0][0]][6] = $objItem.FullName
        $aRet[$aRet[0][0]][7] = $objItem.LocalAccount
        $aRet[$aRet[0][0]][8] = $objItem.Lockout
        $aRet[$aRet[0][0]][9] = $objItem.Name
        $aRet[$aRet[0][0]][10] = $objItem.PasswordChangeable
        $aRet[$aRet[0][0]][11] = $objItem.PasswordExpires
        $aRet[$aRet[0][0]][12] = $objItem.PasswordRequired
        $aRet[$aRet[0][0]][13] = $objItem.SID
        $aRet[$aRet[0][0]][14] = $objItem.SIDType
        $aRet[$aRet[0][0]][15] = $objItem.Status
    Next
    Return $aRet
EndFunc
Edited by smashly

Share this post


Link to post
Share on other sites

As per my prev post add AutoItSetOption("MustDeclareVars", 1). Put this at the top of your script and it will force you to declare them. Read about Global and Local and understand scope, never ise Dim. I recommend going Local whenever possible. Yes, Declare your vars at the top, vars that are only used in Functions declare at the top of the function as Local. Have a look at some other larger scripts and you will get the idea.

Putting #AutoIt3Wrapper_Run_Debug_Mode=Y will output the line of code that is run the console so you know in what order things are being executed.

Use ConsoleWrite to output the values of your vars so you know it is running as it should - ConsoleWrite("objWMIService is " & $objWMIService & @CR).


Post your code because code says more then your words can. SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y. Use Opt("MustDeclareVars", 1)[topic="84960"]Brett F's Learning To Script with AutoIt V3[/topic][topic="21048"]Valuater's AutoIt 1-2-3, Class... is now in Session[/topic]Contribution: [topic="87994"]Get SVN Rev Number[/topic], [topic="93527"]Control Handle under mouse[/topic], [topic="91966"]A Presentation using AutoIt[/topic], [topic="112756"]Log ConsoleWrite output in Scite[/topic]

Share this post


Link to post
Share on other sites

It seems like you are pretty close to completing this, so here is a free bump to the front page while some of the smarter members are online :-)

I know very little about the GUI functions and even less about WMI stuff. Let's see what others can do for you.


[size="1"][font="Arial"].[u].[/u][/font][/size]

Share this post


Link to post
Share on other sites

thank you herewasplato

i did figure out the above situation. now im trying to integrate a progress bar within the script. i started a new thread posted below, do to this being a new situation. but thanks again herewasplato!

New Thread

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  
Followers 0