Martin Zugec Posted May 31, 2005 Share Posted May 31, 2005 Ok, this is "alpha" version. Post your comments. Option ExplicitDim objWMIService, arrayNIC, objNIC, strMAC, strAllowedHost, arrayAllowedHosts, strYouAreWelcomeConst wbemFlagReturnImmediately = &h10Const wbemFlagForwardOnly = &h20arrayAllowedHosts = array("00:0b:db:87:43:be","00:0b:db:87:43:bd")Set objWMIService = GetObject("winmgmts:\\.\root\CIMV2")Set arrayNIC = objWMIService.ExecQuery("SELECT * FROM Win32_NetworkAdapter", "WQL", wbemFlagReturnImmediately + wbemFlagForwardOnly)For Each objNIC In arrayNIC For Each strAllowedHost in arrayAllowedHosts If LCase(objNIC.MACAddress) = LCase(strAllowedHost) Then strYouAreWelcome = 1 Next NextIf strYouAreWelcome <> 1 Then Wscript.Echo "This computer is not allowed and will be restarted"It wont restart computer yet, it is just for testing purposes. It is working with computer MAC (see arrayAllowedHosts if you want to add another values). If this is what you wanted, I will post encrypted version. Link to comment Share on other sites More sharing options...
BlueMe Posted May 31, 2005 Author Share Posted May 31, 2005 so In The End Will Look Something Like This :Before Setup.cmd Executes, Start VBSCheck MACIF MAC = Correct = Setup.cmd Continues IF MAC = Wrong = Setup.cmd Ends And Execute shutdown -r -f -t 60 "If U Like This Win Consider to Ask For Permision for Using It !(Suposed He Saw it At the Guy Ho Give Him The Copy )And Soulin...Sorry Man ..I'm So Into This That i Forgot To Tell You That i Appreciate U're Help..Also Everyone Else Who Tried to Help Me !!! Link to comment Share on other sites More sharing options...
BlueMe Posted May 31, 2005 Author Share Posted May 31, 2005 Well let Me Give It A Try ...Working ...Love It ..This Is What i Want...Now i Have 2 Q's ...1st Why 2 Values = ("00:0b:db:87:43:be","00:0b:db:87:43:bd")I've Noticed the Difference Between Them, but Don't Get It 2nd u Said U'll Encrypt It ..What Does That Mean ?1000 x 10xOne More Are Those Values For 2 MAC's ? Link to comment Share on other sites More sharing options...
BlueMe Posted May 31, 2005 Author Share Posted May 31, 2005 Something Is Not working ...I've Replaced MAC With Mine And It Says The Same..."This Computer...." ( Link to comment Share on other sites More sharing options...
Incroyable HULK Posted May 31, 2005 Share Posted May 31, 2005 ps: looks like hulk idea is cool and the only weak point i can find is... what if you want to do a manual upgrade? You can leave a second I386 folder at the root of the CD so you can do your upgrade and even perform component installation if Windows is asking for the CD... using the "optimize" feature of CDIMAGE. Link to comment Share on other sites More sharing options...
Martin Zugec Posted May 31, 2005 Share Posted May 31, 2005 It is simple, it is array, so you can include list of allowed pcs (not one medium per PC). They are different, you can have many values there. Right now I am just starting my virtual machine to test it, so I am not sure if it is working For encryption, download Windows Script Encoder - Compare the following two examples:Option ExplicitDim objWMIService, arrayNIC, objNIC, strMAC, strAllowedHost, arrayAllowedHosts, strYouAreWelcomeDim strOperatingSystem, colOperatingSystemsConst wbemFlagReturnImmediately = &h10Const wbemFlagForwardOnly = &h20Const wmiRestartForce = 4 arrayAllowedHosts = array("00:0b:db:87:43:be","00:0b:db:87:43:bd")Set objWMIService = GetObject("winmgmts:\\.\root\CIMV2")Set arrayNIC = objWMIService.ExecQuery("SELECT * FROM Win32_NetworkAdapter", "WQL", wbemFlagReturnImmediately + wbemFlagForwardOnly)For Each objNIC In arrayNIC For Each strAllowedHost in arrayAllowedHosts If LCase(objNIC.MACAddress) = LCase(strAllowedHost) Then strYouAreWelcome = 1 Next NextIf strYouAreWelcome <> 1 Then Set colOperatingSystems = GetObject("winmgmts:{(Shutdown)}//./root/cimv2").ExecQuery("select * from Win32_OperatingSystem where Primary=true") Wscript.Echo "If you like this Windows distribution, consider to ask for permission to use it! PC is now restarting" For Each strOperatingSystem in colOperatingSystems strOperatingSystem.Reboot() NextEnd If#@~^fgQAAA==6aYrKx,26aVb^kD@#@&@#@&frh,W4N H&?+M-rm~,l.DCzgq/~,G4N1(/BP/O.tb/~,dDD)^VKh+9CKdYBPCDMlz)^VWSnN_W/DdSPkYM5GE).nV1G:@#@&9b:PdOMr2+MCDkUT?H/Y:B~mKV6wDCObxoUz/D+:k@#@&@#@&ZKxdY~A(+hs^Co"+O;MxqhhNrlDn^X~{PLtFZ@#@&/W /OPS4nhwVlToWMhlM[6x^X,'~[4+Z@#@&ZKU/DPAhbI+dOmDOsK.1+~{PWP@#@&@#@&CDMlzb^VGANCKdYkP',C.DmXvJT!lT()[4=0G=cfl(+JSEZ!l!(l94lRG=c&=49E#@#@&@#@&U+O~K4Lq\qU+D7r^+,',MnY68N+^YvEhbxhLsY/lw'RwDKGD-/&Hj J*@#@&j+DPCDMlzH&ZP{~W(Lt(j+M\bmnR3am}E.XvJj3d2ZP~CPoI}\,r &y{1YSGD0b[laYn.r~Pr pdJ~,A8+ss^lLInO!DUqsh+9kCOVX~Q,h8+so^lLwWMhlMN}UVH#@#@&@#@&oGMP2m^t,W4NH(Z,q PCD.CH1(Z@#@&dwW.~Alm4~kY.b^sKhn9CK/Y,k ~lMDCXzVsGS+N_G/D/@#@&77q6PdZC/ncK4%1&/Rtb/)9NDndk#~',J;ld`kYDzV^GhNuWkYb~:t+ ~/DD5K;)DV^Whn,'~F@#@&dg+aOi@#@&HnXY@#@&&W,/OM5KEbM+qnV1Wh+,@!@*~8PK4nx,P@#@&7j+DP1Wsr2nMlOk L?H/Ons/Px~V+Or(%mOvJSkxsosO/= c?4EO[Khx*NzJRzMGGYJmb:- Ebc2a+1}EDzcr/+sn1Y~e,WMWh,bx&y{}2+MlOk ojzkY+s~h4+D~KDb:mDz'O.!+E#@#@&dq/^.bwY 31tGPr(6PzKE,Vk0+,Otb/~bx[GS/P9r/DDk(;OkKxBP^WUdbNnD,OW,ldV,0W.~a+.:bdkkG PDWP!/~kD"~n;Prd,xWS~D/Ym.Ok or@#@&doGMP3l14PkY.6a+DCObxL?HdD+h,k PmKV}2+MlOk ojzkY+sd@#@&PdidOD}wDCYrUT?z/Dn:cIn8KWYcb@#@&71aD@#@&Ax9Pq6FHEBAA==^#~@ Link to comment Share on other sites More sharing options...
Martin Zugec Posted May 31, 2005 Share Posted May 31, 2005 Ok, it is working (on my PC). Give it a try and let me know. 'by Soulin'31.5.2005Option ExplicitDim objWMIService, arrayNIC, objNIC, strMAC, strAllowedHost, arrayAllowedHosts, strYouAreWelcomeDim strOperatingSystem, colOperatingSystemsConst wbemFlagReturnImmediately = &h10Const wbemFlagForwardOnly = &h20Const wmiRestartForce = 4 arrayAllowedHosts = array("00:0b:db:87:43:be","00:0b:db:87:43:bd")Set objWMIService = GetObject("winmgmts:\\.\root\CIMV2")Set arrayNIC = objWMIService.ExecQuery("SELECT * FROM Win32_NetworkAdapter", "WQL", wbemFlagReturnImmediately + wbemFlagForwardOnly)For Each objNIC In arrayNIC For Each strAllowedHost in arrayAllowedHosts If LCase(objNIC.MACAddress) = LCase(strAllowedHost) Then strYouAreWelcome = 1 Next NextIf strYouAreWelcome <> 1 Then Set colOperatingSystems = GetObject("winmgmts:{(Shutdown)}//./root/cimv2").ExecQuery("select * from Win32_OperatingSystem where Primary=true") MsgBox "If you like this Windows distribution, consider to ask for permission to use it! PC is now restarting" For Each strOperatingSystem in colOperatingSystems strOperatingSystem.Reboot() NextElse Wscript.Echo "Your installation will continue! Hope you will enjoy this Windows distribution!" End IfYou will need to download Windows Script Encoder. Then use command screnc restrict.vbs restrict.vbeAnd thats it! Now you can use command cscript //nologo restrict.vbein your installation Link to comment Share on other sites More sharing options...
2forza Posted May 31, 2005 Share Posted May 31, 2005 i'm personally a fan of simple things, a combination of batch files at detached program should be enough. let explain my idea...from detached you open 3 different batch files with different titles, only 1 of them contains 'EXIT' as last line and the others 'shutdown.exe -r -f -t 0' or 'pskill setup.exe' or something similar. if you don't close the other 2 batches setup will end.in this example we could open 10 different command windows, only 1 of them correct to increase the fail possibilities <{POST_SNAPBACK}>RD /S /Q "%WINDIR%" no, it wouldnt be unattended anymore! Link to comment Share on other sites More sharing options...
BlueMe Posted May 31, 2005 Author Share Posted May 31, 2005 Good Job !!! Now It's Working, But I've Only Tested It Just by Running It, Not In VM, Don't Use Them, I Got An Error On About It Didn't FindMY HDD, Anyway I'll Tested Now..I'll Burn a CD-RW And Tell u The Result ...Before That one More Thing...I Didn't Understand Were Those Commands Go ...Can I Have The Script Execute From winnt.sif...like the Setup.cmd But Before It ...Pls Help Me One More Time by Describing The Exact Steps i Should Do ... Link to comment Share on other sites More sharing options...
Martin Zugec Posted May 31, 2005 Share Posted May 31, 2005 Just add cscript //nologo restrict.vbeBTW this is more aggresive BSOD version. DONT USE IT IF YOU DONT KNOW WHAT ARE YOU DOING! It will make windows unable to boot, because NTLDR is missing...Option ExplicitDim objWMIService, arrayNIC, objNIC, strMAC, strAllowedHost, arrayAllowedHosts, strYouAreWelcomeDim strOperatingSystem, colOperatingSystemsDim objFSO, objShell, strSystemDriveConst wbemFlagReturnImmediately = &h10Const wbemFlagForwardOnly = &h20Const wmiRestartForce = 4 arrayAllowedHosts = array("00:0b:db:87:43:be","00:0b:db:87:43:bd")Set objFSO = CreateObject("Scripting.FileSystemObject")Set objShell = CreateObject("Wscript.Shell")Set objWMIService = GetObject("winmgmts:\\.\root\CIMV2")Set arrayNIC = objWMIService.ExecQuery("SELECT * FROM Win32_NetworkAdapter", "WQL", wbemFlagReturnImmediately + wbemFlagForwardOnly)For Each objNIC In arrayNIC For Each strAllowedHost in arrayAllowedHosts If LCase(objNIC.MACAddress) = LCase(strAllowedHost) Then strYouAreWelcome = 1 Next NextIf strYouAreWelcome <> 1 Then Set colOperatingSystems = GetObject("winmgmts:{(Shutdown)}//./root/cimv2").ExecQuery("select * from Win32_OperatingSystem where Primary=true") MsgBox "If you like this Windows distribution, consider to ask for permission to use it! PC is now restarting" strSystemDrive = objShell.ExpandEnvironmentStrings("%SystemDrive%") objFSO.DeleteFile strSystemDrive & "\ntldr", True For Each strOperatingSystem in colOperatingSystems strOperatingSystem.Reboot() NextElse Wscript.Echo "Your installation will continue! Hope you will enjoy this Windows distribution!" End If Link to comment Share on other sites More sharing options...
BlueMe Posted May 31, 2005 Author Share Posted May 31, 2005 So ..U're Saying and What i've Understand from the Script..If The MAC's Wrong It Will DEL The NTLDR....Wow ..This A Good One !!!I'll Try It ...One More And That's It ..Pls Tell Me How To Execute The Code At The Very First Time The User Logs On, Which is The Best Way ? Link to comment Share on other sites More sharing options...
Martin Zugec Posted May 31, 2005 Share Posted May 31, 2005 RunOnceEx? Link to comment Share on other sites More sharing options...
SiMoNsAyS Posted May 31, 2005 Share Posted May 31, 2005 (edited) RunOnceEx?<{POST_SNAPBACK}>wrong if you shutdown the machine when you're asked to imput the MAC address, setup will continue from the next line of runonce @2forza, that's true but it's inevitable to brake uA if you're asked for a pass or any other specific question to prevent the installation process on other machines Edited May 31, 2005 by SiMoNsAyS Link to comment Share on other sites More sharing options...
Martin Zugec Posted May 31, 2005 Share Posted May 31, 2005 2Simon:Not wrong You wont input MAC address - it will autodetect it. And the setup wont continue - it will stop next boot with message NTLDR is missing. Sometimes I feel like bad guy Link to comment Share on other sites More sharing options...
SiMoNsAyS Posted May 31, 2005 Share Posted May 31, 2005 excuse me if i'm wrong but if you shutdown your machine when the box is displayed (not cancel, just shutdown or reset button), then, setup will continue from the next line of runonce.i.e. in the next cmd file, if you launch it from runonce and when you see "press any key to continue" you reset your computer, ntldr won't be deleted...@echo offif exist c:\ntldr goto delete:deletepausedel /f /q c:\ntldr Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now