Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!-- : Change MAC by AveYo v3.0
- @ECHO OFF &SETLOCAL ENABLEEXTENSIONS
- GOTO :_INIT
- :_START
- CALL "%SSVAR%\cscript.exe" //nologo "%~f0?.wsf" //job:MAC
- EXIT /B
- :_INIT
- CD /D "%~dp0"
- SET "SSVAR=%WINDIR%\SYSTEM32"
- IF DEFINED PROCESSOR_ARCHITEW6432 SET "SSVAR=%WINDIR%\Sysnative"
- MODE 80,2 &COLOR 70 &TITLE %~n0 by A^v^eY^o^ v2^.^0
- IF "%1"=="_SELF_ADMIN" SHIFT &SHIFT &GOTO :_START
- "%SSVAR%\REG.EXE" QUERY "HKEY_USERS\S-1-5-20\Environment" /v TEMP 2>NUL 1>&2 && GOTO :_START || echo Requesting admin rights, if it fails, R-click and 'Run As Administrator' &COLOR 0c
- CALL "%SSVAR%\cscript.exe" //nologo "%~f0?.wsf" //job:ADM "%~f0" &EXIT
- GOTO :eof
- ----- embeded scripts method by DosTips user Liviu --->
- <package>
- <job id="ADM">
- <script language="VBScript">
- On Error Resume Next
- CreateObject("Shell.Application").ShellExecute WScript.Arguments(0), "_SELF_ADMIN " & WScript.Arguments(0), "", "runas", 1
- Err.Clear
- </script>
- </job>
- <job id="MAC">
- <script language="VBScript">
- On Error Resume Next
- const HKEY_LOCAL_MACHINE = &H80000002
- Dim aName,aMAC,aIndex,filterMAC
- Set aREG=GetObject("winmgmts:StdRegProv")
- aKey = "SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}"
- aValue = "NetworkAddress"
- Set aWMI = GetObject ("winmgmts:") 'NetConnectionID='Ethernet'
- Set adapters = aWMI.ExecQuery("Select PhysicalAdapter,PNPDeviceID,ProductName,Index,NetEnabled from Win32_NetworkAdapter where PhysicalAdapter=True and (PNPDeviceID LIKE '%USB%' or PNPDeviceID LIKE '%PCI%')","WQL",48) '48=wbemFlagForwardOnly + wbemFlagReturnImmediately
- For Each adapter in adapters
- With adapter
- aName = .ProductName
- aIndex = "\" & Right("0000" & .Index, 4)
- aREG.GetStringValue HKEY_LOCAL_MACHINE,aKey & aIndex,aValue,aMAC
- If IsNull(aMAC) Then aMAC=""
- changeMAC=Trim(InputBox(aName & vbCrLf & vbCrLf & "Enter new MAC address: (any separator .,: works)" & vbCrLf & "or 0 to reset it", "ChangeMac by AveYo", aMAC))
- filterMAC=Split("._ _,_:_;_-_<_>_[_]_{_}_(_)","_")
- For each x in filterMAC
- changeMAC=Replace(changeMAC,x,"")
- WScript.Echo changeMAC
- Next
- If changeMAC <> aMAC And changeMAC <> "" Then
- If changeMAC="0" Then aREG.DeleteValue HKEY_LOCAL_MACHINE,aKey & aIndex,aValue Else aREG.SetStringValue HKEY_LOCAL_MACHINE,aKey & aIndex,aValue,changeMAC End If
- 'If (.NetEnabled) Then adapter.disable() Else adapter.enable()
- 'If Not (.NetEnabled) Then adapter.enable() Else adapter.disable()
- End If
- End With
- Next
- Err.Clear
- </script>
- </job>
- </package>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement