Sziasztok!

A script a következő, vbs-ben készült, a GroupPolicy hívja meg, így helyi rg jogokkal fut le minden gépinduláskor:

Dim oSysInfo
Set oSysInfo = CreateObject("WinNTSystemInfo")

Dim Stuff, myFSO, WriteStuff, dateStamp
dateStamp = Date()

'Write information to Text File
Stuff = " "

Set myFSO = CreateObject("Scripting.FileSystemObject")
Set WriteStuff = myFSO.CreateTextFile("c:\windows\temp\pimage.log")
WriteStuff.WriteLine date



Dim CompName
CompName = oSysInfo.ComputerName
gepterem="kgt"


strComputer = "."
Set objWMIService = GetObject( _
    "winmgmts:\\" & strComputer & "\root\cimv2")
Set IPConfigSet = objWMIService.ExecQuery _
    ("Select IPAddress from Win32_NetworkAdapterConfiguration ")

Set WshShell = wscript.createobject("wscript.shell")

For Each IPConfig in IPConfigSet
    If Not IsNull(IPConfig.IPAddress) Then
        For i=LBound(IPConfig.IPAddress) to UBound(IPConfig.IPAddress)
              if instr(ltrim(IPConfig.ipaddress(i)),"192.168.10")=1 then
                 ip=(mid(IPConfig.IPAddress(i),13,20))
                 net=(mid(IPConfig.IPAddress(i),9,3))
                 if instr(ucase(net),ucase("101"))>0 then
                   gepterem="EGT"
                 end if
                 if instr(ucase(net),ucase("102"))>0 then
                   gepterem="VBGT"
                 end if

                 if instr(ucase(net),ucase("103"))>0 then
                   gepterem="TI"
                 end if

                 if instr(ucase(net),ucase("104"))>0 then
                   gepterem="AGT"
                 end if

                 if instr(ucase(net),ucase("109"))>0 then
                   gepterem="XC"
                 end if
                 while len(ip)<2
                     ip="0"+ip
                 wend
                 if ucase(compname) <> ucase(gepterem+ip) then
                   WriteStuff.WriteLine("uj nev:"+gepterem+ip)
                   WshShell.Run "c:\windows\pimage\wsname.exe /logfile:c:\windows\temp\wsname.log /lot /n:"+gepterem+ip+" /wg:"+gepterem ,2 ,true
                   WriteStuff.WriteLine("reg.exe")
                   wshshell.run "reg.exe delete HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate /v SusClientID /f" ,2 ,true
                   WriteStuff.WriteLine("wuauclt")
                   wshshell.run "wuauclt.exe /resetauthorization" ,2 ,true
                   WriteStuff.WriteLine("restart...")
                   WriteStuff.close
                   wshshell.Run("shutdown -t 10 -r ")
                 end if
              end if
        Next
    End If
Next
Writestuff.close

Tippeket, ötleteket, hozzászólásokat várom!

Üdv:

               TT

2019.07.17. 10:45 keltezéssel, Alaksza Balázs írta:
Engem érdekelne, miben készült? domainbe léptetéshez esetleg ez? <https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.management/add-computer?view=powershell-5.1>

_______________________________________________
Techinfo mailing list
Techinfo@lista.sulinet.hu
Fel- és leiratkozás: http://lista.sulinet.hu/cgi-bin/mailman/listinfo/techinfo
Illemtan: http://www.szag.hu/illemtan.html
Ügyfélszolgálat FAQ: http://sulinet.niif.hu/

válasz