lusrmgr.msc kullanıcıları ve grupları gösterir
23 Eylül 2020 Çarşamba
Snap-in
fsmgmt.msc share edilen dizinleri gösterir.
Powershell Remove-Item - Dosya ve Dizin Siler
Giriş
Açıklaması şöyle
Remove-Item *.tmp or any of its aliases like rm *.tmp, del *.tmp
Örnek
Şöyle yaparız
CMD Example:del TestItem.txtPowershell Example:remove-item TestItem.txt
Örnek
Şöyle yaparız
$mydirectory ="..."$excludedirectory1 ="..."$excludedirectory2 ="..."Remove-Item $mydirectory\* -Exclude $excludedirectory1 $excludedirectory2 -Recurse
-Force -ErrorAction Ignore
22 Eylül 2020 Salı
Powershell New-Item
-Path seçeneği
Örnek
Şöyle yaparız
CMD Example:md testdirectoryPowershell Example:New-Item -Path "c:\" -Name "testdirectory" -ItemType "directory"
Örnek
$directory = "..."
$myuser="..."
$denieduser="..."
New-Item -Path $directory -ItemType Directory
$acl = Get-Acl -Path $directory
#Give full control to this folder,subfolders and files
$rule = New-Object System.Security.AccessControl.FileSystemAccessRule
($myuser,"FullControl","ContainerInherit, ObjectInherit", "None", "Allow")
$acl.AddAccessRule($rule)
#Deny full control to another user
$rule = New-Object System.Security.AccessControl.FileSystemAccessRule
($denieduser,"FullControl", "Deny")
$acl.AddAccessRule($rule)
#Set owner
$owner=New-Object System.Security.Principal.NTAccount($myuser)
$acl.SetOwner($owner)
Set-Acl $directory $acl | Out-Null
17 Eylül 2020 Perşembe
16 Eylül 2020 Çarşamba
Powershell New-PSSession
Giriş
Invoke-Command -Session $remoteSession -ArgumentList(...) -ScriptBlock {...} şeklinde uzak makinede komut çalıştırmak içindir.
Session ile işimiz bitince Remove PSSession ile kapatılır
Örnek
Şöyle yaparızz
Invoke-Command -Session $remoteSession -ArgumentList(...) -ScriptBlock {...} şeklinde uzak makinede komut çalıştırmak içindir.
Session ile işimiz bitince Remove PSSession ile kapatılır
Örnek
Şöyle yaparızz
$username = "myuser"
$password = "mypassword"
$secureString = ConvertTo-SecureString $password -ASPlainText -Force
$credentials = New-Object System.Management.Automation.PSCredentials($username,
$secureString)
$computer = "..."
$remoteSession = New-PSSession $computer -Credential $credentials
...
Remove PSSession -Session $remoteSession
10 Eylül 2020 Perşembe
Powershell Start-Job - Arka Planda İş Başlatır
Giriş
Bu komut arka planda iş başlatırken Invoke-Command ön planda iş başlatır.
Backtick
Backtick ile satırları bölmek iyi değil. Onun yerine zaten bölünebilecek yerlde bölmek lazım. Açıklaması şöyle.
Örnek
Şöyle yaparız. scriptBlock arka planda çalıştırılacak metodu temsil eder. Bu metod bir parametre ile çağrılır
Bu komut arka planda iş başlatırken Invoke-Command ön planda iş başlatır.
Backtick
Backtick ile satırları bölmek iyi değil. Onun yerine zaten bölünebilecek yerlde bölmek lazım. Açıklaması şöyle.
The best thing is to leave out the line continuation character and simply break at the pipe, the comma, the brace, or the parenthesis because Windows PowerShell is expecting it anyway, and you avoid a potential source of failure.ScriptBlock seçeneği
Örnek
Şöyle yaparız. scriptBlock arka planda çalıştırılacak metodu temsil eder. Bu metod bir parametre ile çağrılır
$Param1 = "..."
$Computers =(Get-Content "computers.txt")
foreach ($computer in $Computers) {
$scriptBlock = {
param($ScriptParam1)
...
}
Start-Job -Name "Job-$computer" -ScriptBlock $scriptBlock -ArgumentList ($Param1)
}
#wait for jobs to finish
Get-Job | Wait-Job
#Show output of jobs
Get-Job | Receive-Job
9 Eylül 2020 Çarşamba
Windows netsh komutu
interface ipv4 show address
Ağ arayüzlerimizin IPV4 adreslerini görmek için şöyle yaparız
TCP paketlerini yakalamak içindir.
Örnek
Yakalamaya başlamak için şöyle yaparız
Ağ arayüzlerimizin IPV4 adreslerini görmek için şöyle yaparız
netsh interface ipv4 show address
interface ipv4 show subinterfaces
Ağ arayüzlerimizin MTU değerlerini görmek için şöyle yaparız
>netsh interface ipv4 show subinterfaces
MTU MediaSenseState Bytes In Bytes Out Interface
------ --------------- --------- --------- -------------
4294967295 1 0 0 Loopback Pseudo-Interface 1
1500 1 2180082896 106590535 EthernetDeğiştirmek için şöyle yaparız
>netsh interface ipv4 set subinterface "Ethernet" mtu=1492 store=persistentinterface portproxy
port forwarding içindir. Açıklaması şöyle
It should not persist a reboot unless you specify store=persistent. You can delete the rule yourself by running similar to netsh interface portproxy delete v4tov4 listenaddress=192.168.x.y listenport=3306
Örnek
Açıklaması şöyle
Alternatively you could configure port forwarding to forward traffic destined for 192.168.x.y on port 3306 to 127.0.0.1 on port 3306 using syntax similar to the below command.
Şöyle yaparız
netsh interface portproxy add v4tov4 listenaddress=192.168.x.y listenport=3306
connectaddress=127.0.0.1 connectport=3306
Örnek
Şöyle yaparız. Burada kendi Window bilgisayarımda port forwarding yaparak, ssh isteklerini WSL 2 üzerinde çalışan SSH sunucusuna yönlendiriyorum.
netsh interface portproxy add v4tov4 listenport=4000 listenaddress=0.0.0.0 connectport=4000 connectaddress=172.26.66.223
trace start çeneği
Örnek
Yakalamaya başlamak için şöyle yaparız
netsh trace start capture=yes tracefile=c:\temp\trace.etl
Durdurmak için şöyle yaparıznetsh trace stop
Kaydol:
Kayıtlar (Atom)