Jump to content

njdev1k

Members
  • Posts

    12
  • Joined

  • Last visited

njdev1k's Achievements

Seeker

Seeker (1/7)

0

Reputation

  1. StringRegExpReplace worked perfect, thanks for your help!
  2. I am trying to return just the file name and not the entire path to the file using FileOpenDialog to a label, how do I break it down to just file name selected? Partial code below FileInstall("C:\TargetReset\TargetReset.exe", $destination2, 1) FileInstall("C:\TargetReset\radesdkpia.dll", $destination3, 1) FileInstall("C:\TargetReset\TargetReset.pdb", $destination4, 1) FileInstall("C:\TargetReset\TargetReset.vshost.exe", $destination5, 1) FileInstall("C:\TargetReset\info.txt", $destination6, 1) $filelbl = GuiCtrlCreateLabel("Select profile to reset", 10, 20, 100, 20) $filebutton = GuiCtrlCreateButton("Select Profile", 10, 40, 100, 20) $filelbl2 = GuiCtrlCreateLabel("Select cab file GUID to reset", 260, 20, 150, 20) $filebutton2 = GuiCtrlCreateButton("Select Cab", 280, 40, 100, 20) $info1 = GUICtrlCreateLabel("Profile: ", 10, 80, 480, 40) $info2 = GUICtrlCreateLabel("GUID: ", 10, 160, 300, 20) ;$Proglbl = GuiCtrlCreateLabel("Target Reset Utility", 10, 10, 220, 20) ;$guidlbl = GuiCtrlCreateLabel("Enter GUID to reset", 10, 80, 220, 20) ;$guid = GUICtrlCreateInput("", 10, 100, 300, 20) $Runlbl = GuiCtrlCreateLabel("Execute against target", 10, 220, 140, 20) $Runbutton = GuiCtrlCreateButton("Run", 10, 240, 100, 20) $Cancelbutton = GuiCtrlCreateButton("Quit", 280, 240, 100, 20) $var = "" $bLoop = 1 While $bLoop = 1 $msg = GuiGetMsg() Select Case $msg = -3 Exit Case $msg = $filebutton $var = FileOpenDialog("Select profile", @ScriptDir, "Profiles (*.profile)", 1) $chosen = ($var) GUICtrlSetData($info1, "Profile: " & $chosen) $bLoop = 1
  3. You can comment out the Icon entry. But make sure you point to where the psexec.exe is.
  4. Here is a GUI front end I created for PSTools psexec. Edit the script as needed. This is created to read from a text file called computers.txt from the same folder as the compiled gui. Edited: added script as attachment instead of as text. PsexecGUIFrontend.au3
  5. Is there a way to grey out or disable the Close window button on the GUI window? I am speaking of the "X" in the top right corner of the window.
  6. LOL, I agree. I use VB as little as possible. I've been using AutoIt GUI alot lately, which is awesome.
  7. This script provides the information you want and alot more, just remove what you do not need. After it is run it will create a text file in the same location as the script called (computername).txt On Error Resume Next Set oShell = CreateObject("wscript.Shell") Set env = oShell.environment("Process") strComputer = env.Item("Computername") Const HKEY_LOCAL_MACHINE = &H80000002 Const UnInstPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_ ".\root\default:StdRegProv") report = strComputer & " Computer Inventory" & vbCrLf & "******************************************" & vbCrLf & vbCrLf Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2") Set colItems = objWMIService.ExecQuery("Select * from Win32_OperatingSystem",,48) report = report & vbCrLf & "******************************************" & vbCrLf report = report & "OS Information" & vbCrLf & "******************************************" & vbCrLf & vbCrLf For Each objItem in colItems report = report & "Caption: " & objItem.Caption & vbCrLf report = report & "Description: " & objItem.Description & vbCrLf report = report & "EncryptionLevel: " & objItem.EncryptionLevel & vbCrLf report = report & "InstallDate: " & objItem.InstallDate & vbCrLf report = report & "Manufacturer: " & objItem.Manufacturer & vbCrLf report = report & "MaxNumberOfProcesses: " & objItem.MaxNumberOfProcesses & vbCrLf report = report & "Name: " & objItem.Name & vbCrLf report = report & "Organization: " & objItem.Organization & vbCrLf report = report & "OSProductSuite: " & objItem.OSProductSuite & vbCrLf report = report & "RegisteredUser: " & objItem.RegisteredUser & vbCrLf report = report & "SerialNumber: " & objItem.SerialNumber & vbCrLf report = report & "ServicePackMajorVersion: " & objItem.ServicePackMajorVersion report = report & "ServicePackMinorVersion: " & objItem.ServicePackMinorVersion & vbCrLf report = report & "Version: " & objItem.Version & vbCrLf report = report & "WindowsDirectory: " & objItem.WindowsDirectory & vbCrLf Next Set colSettings = objWMIService.ExecQuery _ ("Select * from Win32_ComputerSystem") report = report & vbCrLf & "******************************************" & vbCrLf report = report & "Memory and Processor Information" & vbCrLf & "******************************************" & vbCrLf & vbCrLf For Each objComputer in colSettings 'report = report & objComputer.Name & vbcrlf report = report & objComputer.TotalPhysicalMemory /1024\1024+1 & "MB Total memory" & vbcrlf Next Set colSettings = objWMIService.ExecQuery _ ("Select * from Win32_Processor") For Each objProcessor in colSettings report = report & objProcessor.Description & " Processor" & vbCrLf Next Set cInstances = GetObject("winmgmts:{impersonationLevel=impersonate}//" &_ strComputer & "/root/cimv2:Win32_Service").Instances_ '******************************** '*** Enumerate instances in the loop, for each, list relevant properties report = report & vbCrLf & "******************************************" & vbCrLf report = report & "Services" & vbCrLf & "******************************************" & vbCrLf & vbCrLf For Each oInstance In cInstances report = report & "Name:" & vbTab & vbTab & oInstance.Properties_("Name").Value & vbCrLf report = report & "DisplayName:" & vbTab & oInstance.Properties_("DisplayName").Value & vbCrLf report = report & "StartMode:" & vbTab & oInstance.Properties_("StartMode").Value & vbCrLf report = report & "State:" & vbTab & vbTab & oInstance.Properties_("State").Value & vbCrLf Next report = report & vbCrLf & "******************************************" & vbCrLf report = report & "Disk Drive Information" & vbCrLf & "******************************************" & vbCrLf & vbCrLf Set objWMIService = GetObject("winmgmts:") Set objLogicalDisk = objWMIService.Get("Win32_LogicalDisk.DeviceID='c:'") report = report & objLogicalDisk.FreeSpace /1024\1024+1 & "MB Free Disk Space" & vbCrLf report = report & objLogicalDisk.Size /1024\1024+1 & "MB Total Disk Space" & vbCrLf oReg.EnumKey HKEY_LOCAL_MACHINE, UnInstPath, arrSubKeys software = software & vbCrLf & "******************************************" & vbCrLf software = software & "Installed Software" & vbCrLf & "******************************************" & vbCrLf & vbCrLf For Each subkey In arrSubKeys 'MsgBox subkey If Left (subkey, 1) <> "{" Then software = software & subkey & vbCrLf End If Next Set fso = CreateObject("Scripting.FileSystemObject") Set ts = fso.CreateTextFile (strComputer & ".txt", ForWriting) ts.write report ts.write software 'MsgBox Report MsgBox "Done"
  8. Here is a vbs script using WMI that can get the info you want. It also displays username and PC name On Error Resume Next strComputer = "." Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2") Set colItems = objWMIService.ExecQuery("Select * from Win32_TimeZone",,48) Set colItems2 = objWMIService.ExecQuery("Select * from Win32_ComputerSystem",,48) report = "" For Each objItem in colItems report = report & vbCrLf & "Current Time Zone: " & objItem.Description & vbCr & _ "" Next For Each objItem in colItems2 report = report & vbCrLf & "UserName: " & objItem.UserName & vbCrLf & _ "PC Name: " & objItem.Name & vbCrLf & _ "Manufacturer: " & objItem.Manufacturer & vbCrLf & _ "Model: " & objItem.Model & vbCrLf & _ "" Next Wscript.Echo report
  9. If you create a script to read the values below it will give you the make and model. I do have a script that does this, I just need to locate it. :-) Registry path HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\OemInfo String Values WbemProduct (THIS IS THE MAKE) WbemOem (THIS IS THE MODEL)
  10. OK problem solved. I moved the netdom.exe to C:\Windows\System32 and then ran RunWait(@comspec & " /k Netdom.exe JOIN COMPUTERNAME /DOMAIN:domainname /UserD:" & $username & " /PasswordD:" & $passwd ) I took out the C:\ before netdom.exe Thank you for your help, you rock JdeB!!!!
  11. Yes I'm sure Netdom is in that location, the command you provided did not work. Thanks for trying.
  12. Is there a way to run Netdom to join a machine to a domain through autoit? I have tried the below script and also rewritten the command for netdom a few times. Dim $username, $passwd $bLoop = 1 While $bLoop = 1 $username = InputBox("Username", "Please enter your username and click OK", "Ex. johndo", "") If @error = 1 Then MsgBox(4096, "Error", "You pressed 'Cancel' - try again!") Else If $username = "" Then MsgBox(4096, "Error", "You must enter your username") Else $bLoop = 0 EndIf EndIf WEnd $bLoop = 1 While $bLoop = 1 $passwd = InputBox("Password", "Please enter your password and click OK", "", "*") If @error = 1 Then MsgBox(4096, "Error", "You pressed 'Cancel' - try again!") Else If $passwd = "" Then MsgBox(4096, "Error", "You must enter your password") Else $bLoop = 0 EndIf EndIf WEnd $bLoop = 1 While $bLoop = 1 $computeramt = InputBox("Computer", "Please enter what number computer this is Ex. If this is your Only computer leave 01 and hit OK", "01", "") If @error = 1 Then MsgBox(4096, "Error", "You pressed 'Cancel' - try again!") Else If $computeramt = "" Then MsgBox(4096, "Error", "You must enter a number") Else $bLoop = 0 EndIf EndIf WEnd RunWait("C:\Netdom.exe JOIN COMPUTERNAME /DOMAIN:domainname /UserD:$username /PasswordD:$passwd","",@SW_HIDE)
×
×
  • Create New...