Jump to content

nivtop

Members
  • Posts

    8
  • Joined

  • Last visited

nivtop's Achievements

Seeker

Seeker (1/7)

0

Reputation

  1. Hello all, I'm trying to capture only the LAN mac address and ignore all other cards (wireless,etc..) I'm using this code: Func MacAddress2() $objWMIService = ObjGet("winmgmts:{impersonationLevel=impersonate}") $netAdapterSet = $objWMIService.ExecQuery("select MACAddress from Win32_NetworkAdapterConfiguration Where IPEnabled = True") For $netAdapter in $netAdapterSet MsgBox(0, "", $netAdapter.MACAddress) Next $objNetwork = "" $netAdapterSet = "" EndFunc Which displays all active mac addresses....although I want only LAN and doesnt matter if its active or not i still want it to display only the LAN mac address.. anyone know how to do this? Thanks
  2. nevermind.. i figured it out.. glad noone wasted time on this... i shouldve just spent a few more minutes before posting. sorry again $Temp = StringReplace(StringTrimLeft($Output[2], StringInStr($Output[2], '=', 0, -1)), '"', '') $aSystemUsers = StringReplace(StringTrimLeft($Output[1], StringInStr($Output[1], '=', 0, -1)), '"', '') msgbox(0, "test", $Temp&"\"&$aSystemUsers, 0)
  3. Hello, i'm very sorry for being such a noob at splitting strings but I can't figure this out. I'm trying to get the result of: DOMAINUSERNAME From this code I found it split the string to only "USERNAME" and i cant figure out how to get the "DOMAIN" part back into it. I realized this won't give me the true domain name.. just computername if I split it. Does anyone know how to get a full list of DOMAIN/Useraccounts ? LOCALusername1 LOCALusername2 DOMAINusername3 DOMAINusername4 etc.... #include <Array.au3> $Users = _SystemUsers(0) _ArrayDisplay($Users) #cs =============================================================================== Function: _SystemUsers($AccountType = 0) Description: Return an array with the local or domain username Parameter(s): $AccountType: Local, domain or both username 0 = Local and Domain usernames 1 = Local usernames only 2 = Domain usernames only Returns: An array with the list of usernames - Succeeded @error 1 - Didn't query any username @error 2 - Failed to create Win32_SystemUsers object @error 3 - Invalid $AccountType Author(s): Danny35d #ce =============================================================================== Func _SystemUsers($AccountType = 0) Local $aSystemUsers Local $wbemFlagReturnImmediately = 0x10, $wbemFlagForwardOnly = 0x20 Local $colItems = "", $strComputer = "localhost" If Not StringRegExp($AccountType, '[012]') Then Return SetError(3, 3, '') $objWMIService = ObjGet("winmgmts:" & $strComputer & "rootCIMV2") $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_SystemUsers", "WQL", _ $wbemFlagReturnImmediately + $wbemFlagForwardOnly) If IsObj($colItems) Then For $objItem In $colItems $Output = StringSplit($objItem.PartComponent, ',') If IsArray($Output) Then $Temp = StringReplace(StringTrimLeft($Output[2], StringInStr($Output[2], '=', 0, -1)), '"', '') If $AccountType = 0 Or ($AccountType = 1 And @ComputerName = $Temp) Then $aSystemUsers &= StringReplace(StringTrimLeft($Output[1], StringInStr($Output[1], '=', 0, -1)), '"', '') & '|' ElseIf $AccountType = 2 And @ComputerName <> $Temp Then $aSystemUsers &= StringReplace(StringTrimLeft($Output[1], StringInStr($Output[1], '=', 0, -1)), '"', '') & '|' EndIf EndIf ;$aSystemUsers &= $Output[1] Next $aSystemUsers = StringTrimRight($aSystemUsers, 1) If $aSystemUsers = '' Then Return(SetError(1, 1, $aSystemUsers)) Return(SetError(0, 0, StringSplit($aSystemUsers, '|'))) Else $aSystemUsers = '' Return(SetError(2, 2, $aSystemUsers)) EndIf EndFunc ;==>_SystemUsers
  4. Thanks for the replies guys, I'm going to try the tips you gave. Thanks again!
  5. Hello, I made a script that works perfectly on windows xp although when I use it on windows 7 the script doesn't copy files properly because windows 7 security prompts popup when the script is trying to filecopy... Is there a way to get around this? Can someone please help! My script is trying to copy files from external harddrive to C:\Users\Accountname\Desktop ... \Favorites ... \Documents..etc Also I don't have this issue on my home computer but this script is meant for my company which I use at work and the computers at work are windows 7 and on a DOMAIN and the user account has administrative privileges. Thanks
  6. Would anyone know how to make my search function search for *.pst files faster and more efficient? Thx
  7. Thx everyone for the input helped me out
  8. Hello all I'm new to autoit scripting so please bare with me... this is my Search function which searches local drives for .PST files and if any are found they are copied to /My Documents/PST/ directory although I had some issues with PST files that are the same filename so I needed to implement some auto rename & add '1' to end of filename.. this kinda works but sometimes it makes too many copies of the same .PST files when auto-renaming For example, theres 2 archive.pst files with same filename so its suppose to rename only one file to archive(1).pst and thats it..although its making more duplicates: archive(1).pst, archive(1)(1).pst, archive(1)(1)(1).pst.. maybe someone can help me clean it up and work properly Func Search($current) Local $search = FileFindFirstFile($current & "\*.*") While 1 Dim $file = FileFindNextFile($search) If @error Or StringLen($file) < 1 Then ExitLoop ;Add pst / pab files to the array and backup If Not StringInStr(FileGetAttrib($current & "\" & $file), "D") and Not StringInStr($current & "\" & $file, $pstdest) And ($file <> "." Or $file <> "..") And StringRight($file, 3) = "pst" or StringRight($file, 3) = "pab" Then $filexists = $pstdest & $file If FileExists ($filexists) Then $position = StringInStr($filexists, '.', 0, -1) $filename = StringLeft($filexists, $position -1) $extension = StringMid($filexists, $position) For $i = 1 To 1000000 $newfilename = $filename & "(" & $i & ")" & $extension If FileCopy($filexists, $newfilename) Then ExitLoop Next MsgBox(4096,"PST FILENAME DUPLICATE", "Original PST: " & $filexists & " New PST Filename: " & $newfilename, 10) $result = 3 ;dont ask Else $result = FileCopyP($current & "\" & $file, $pstdest) EndIf ;Write to log file. If $result = 1 Then _FileWriteLog($backupdest&"\" & "pstlog.log", "BACKUP SUCCESS: " & $current & "\" & $file) ElseIf $result = 3 Then _FileWriteLog($backupdest&"\" & "pstlog.log", "**RENAME** BACKUP SUCCESS: " & $current & "\" & $file & " RENAMED TO: " & $newfilename) Else _FileWriteLog($backupdest&"\" & "pstlog.log", "**FAIL** BACKUP FAILURE: " & $current & "\" & $file) Endif EndIf If StringInStr(FileGetAttrib($current & "\" & $file), "D") And ($file <> "." Or $file <> "..") AND StringInStr($current & "\" & $file, $pstdest) = 0 Then Search($current & "\" & $file) EndIf WEnd FileClose($search) EndFunc
×
×
  • Create New...