Hi Everybody
I trying to write a script to get the PC info on my network and input in a text file.
I would like to name the text file with the computername.
How would I do this?
I have been searching this forum and came up with this script so far.
#include <file.au3>
$UserName = @UserName
$LogonDomain = @LogonDomain
$PCName = @ComputerName
$IPAdress = @IPAddress1
$WinVer = @OSVersion
$ServicePack = @OSServicePack
Func _GetMACFromIP($sIP)
Local $MAC, $MACSize
Local $i, $s, $r, $iIP
$MAC = DllStructCreate("byte[6]")
$MACSize = DllStructCreate("int")
DllStructSetData($MACSize, 1, 6)
$r = DllCall("Ws2_32.dll", "int", "inet_addr", "str", $sIP)
$iIP = $r[0]
$r = DllCall("iphlpapi.dll", "int", "SendARP", "int", $iIP, "int", 0, "ptr", DllStructGetPtr($MAC), "ptr", DllStructGetPtr($MACSize))
$s = ""
For $i = 0 To 5
If $i Then $s = $s & ":"
$s = $s & Hex(DllStructGetData($MAC, 1, $i + 1), 2)
Next
Return $s
EndFunc ;==>_GetMACFromIP
$IP = $IPAdress
$MAC = _GetMACFromIP($IP)
FileWrite(@ScriptDir & "\Text.txt", $UserName & @CRLF)
FileWrite(@ScriptDir & "\Text.txt", $PCName & @CRLF)
FileWrite(@ScriptDir & "\Text.txt", $IPAdress & @CRLF)
FileWrite(@ScriptDir & "\Text.txt", $WinVer & @CRLF)
FileWrite(@ScriptDir & "\Text.txt", $MAC & @CRLF)
; FileWrite(@ScriptDir & "\Text.txt", $PCName & @CRLF)
; FileWrite(@ScriptDir & "\Text.txt", $IPAdress & @CRLF)
_FileWriteLog(@ScriptDir & "\Text.txt","date and time")
Can7