Jump to content

Cmd Veya Vbs Komutlarıyla Basit Otomasyon (soru)


Puuuuuh
 Share

Recommended Posts

herkese kolay gelsin arkadaşlar

Cmd ve vbs üzerinde pek bilgim olmadığı için topluluğa soruyorum

yapmak istediğim şey kısaca;

netsh interface ip set address name="Local Area Connection" static 192.168.1.1 255.255.255.0 192.168.1.100

ve

netdom /domain:test /user:test /password:test <bilgisayar adı> /joindomain

kodlarını kullanarak cmd veya vbs üzerinden basit bir otomasyon yapmak

bu kodların içinden ip set i ve bilgisayar adını bana sormasını ve elle girilmesini istiyorum bunu en kolay hangi şekilde yapabilirim?

konuyu yanlış yere açmışsam özür dilerim

Link to comment
Share on other sites

  • 3 hafta sonra ...
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <GuiIPAddress.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 560, 310, -1, -1)
$Group1 = GUICtrlCreateGroup("NetSh", 11, 8, 538, 177)
GUICtrlSetFont(-1, 10, 400, 0, "Tahoma")
$Input1 = GUICtrlCreateInput("Local Area Connection", 32, 40, 496, 24)
GUICtrlSetFont(-1, 10, 400, 0, "Tahoma")
$IPAddress1 = _GUICtrlIpAddress_Create($Form1, 32, 80, 354, 21)
_GUICtrlIpAddress_Set($IPAddress1, "0.0.0.0")
$IPAddress2 = _GUICtrlIpAddress_Create($Form1, 32, 112, 354, 21)
_GUICtrlIpAddress_Set($IPAddress2, "0.0.0.0")
$IPAddress3 = _GUICtrlIpAddress_Create($Form1, 32, 144, 354, 21)
_GUICtrlIpAddress_Set($IPAddress3, "0.0.0.0")
$Button1 = GUICtrlCreateButton("Run", 400, 78, 130, 88)
GUICtrlSetFont(-1, 10, 400, 0, "Tahoma")
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group2 = GUICtrlCreateGroup("NetDom", 11, 192, 538, 105)
GUICtrlSetFont(-1, 10, 400, 0, "Tahoma")
$Input2 = GUICtrlCreateInput("", 32, 236, 354, 24)
GUICtrlSetFont(-1, 10, 400, 0, "Tahoma")
$Button2 = GUICtrlCreateButton("Run", 400, 222, 130, 49)
GUICtrlSetFont(-1, 10, 400, 0, "Tahoma")
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
	$nMsg = GUIGetMsg()
	Switch $nMsg
		Case $GUI_EVENT_CLOSE
			Exit
		Case $Button1
			$str = GUICtrlRead($Input1)
			$ip1 = _GUICtrlIpAddress_Get($IPAddress1)
			$ip2 = _GUICtrlIpAddress_Get($IPAddress2)
			$ip3 = _GUICtrlIpAddress_Get($IPAddress3)
			$cmd =  "netsh interface ip set address name=" & '"' & $str & '"' & " static " & $ip1 & " " & $ip2 & " " & $ip3
			RunWait(@ComSpec & " /c " & $cmd)
		Case $Button2
			$str2 = GUICtrlRead($Input2)
			$cmd2 = "netdom /domain:test /user:test /password:test " & $str2 & " /joindomain"
			RunWait(@ComSpec & " /c " & $cmd2)
	EndSwitch
WEnd

 

  • Like 2
Link to comment
Share on other sites

ip = InputBox("IP adresini girin:", "IP Adresi", "192.168.1.1")
subnet = InputBox("Alt Ağı girin:", "Alt Ağ", "255.255.255.0")
gateway = InputBox("Ağ Geçidi'ni girin:", "Ağ Geçidi", "192.168.1.100")
computerName = InputBox("Bilgisayar adını girin:", "Bilgisayar Adı", "")

Set objShell = CreateObject("WScript.Shell")

' IP ayarları
objShell.Run "netsh interface ip set address name=""Local Area Connection"" static " & ip & " " & subnet & " " & gateway, 0, True

' Alanına katılma işlemi
objShell.Run "netdom /domain:test /user:test /password:test " & computerName & " /joindomain", 0, True

 

 

Veya şu komutu yapabilirsin

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <GuiIPAddress.au3>
#include <WindowsConstants.au3>

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 560, 310, -1, -1)
$Group1 = GUICtrlCreateGroup("NetSh", 11, 8, 538, 177)
GUICtrlSetFont(-1, 10, 400, 0, "Tahoma")
$Input1 = GUICtrlCreateInput("Local Area Connection", 32, 40, 496, 24)
GUICtrlSetFont(-1, 10, 400, 0, "Tahoma")
$IPAddress1 = _GUICtrlIpAddress_Create($Form1, 32, 80, 354, 21)
_GUICtrlIpAddress_Set($IPAddress1, "0.0.0.0")
$Button1 = GUICtrlCreateButton("Run", 400, 78, 130, 88)
GUICtrlSetFont(-1, 10, 400, 0, "Tahoma")
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group2 = GUICtrlCreateGroup("NetDom", 11, 192, 538, 105)
GUICtrlSetFont(-1, 10, 400, 0, "Tahoma")
$Input2 = GUICtrlCreateInput("", 32, 236, 354, 24)
GUICtrlSetFont(-1, 10, 400, 0, "Tahoma")
$Button2 = GUICtrlCreateButton("Run", 400, 222, 130, 49)
GUICtrlSetFont(-1, 10, 400, 0, "Tahoma")
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            $str = GUICtrlRead($Input1)
            $ip = _GUICtrlIpAddress_Get($IPAddress1)
            $cmd = 'netsh interface ip set address name="' & $str & '" static ' & $ip
            RunWait(@ComSpec & ' /c ' & $cmd)
        Case $Button2
            $str2 = GUICtrlRead($Input2)
            $cmd2 = 'netdom /domain:test /user:test /password:test ' & $str2 & ' /joindomain'
            RunWait(@ComSpec & ' /c ' & $cmd2)
    EndSwitch
WEnd
 

Edited by bensuslu11
  • Like 2
Link to comment
Share on other sites

  • 2 hafta sonra ...
  • 5 hafta sonra ...

Paylaşmayı düşünmüyor musun kardeşim :)

Puuuuuh, 22.11.2023 - 15:16 yazdı:

çok teşekür ediyorum verdiğiniz kodları iskelet alıp sıfır bilgiyle bu hale getirdim hepsi sizin sayenizde çok sağ olun [url=https://hizliresim.com/a7d9rcq][img]https://i.hizliresim.com/a7d9rcq.png[/img][/url]

 

  • Like 1
Link to comment
Share on other sites

  • 2 hafta sonra ...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...