added netsh commands
This commit is contained in:
parent
20c273fb3d
commit
62a17360b5
1 changed files with 35 additions and 4 deletions
39
posh.txt
39
posh.txt
|
|
@ -83,6 +83,7 @@ Habr: PowerShell и его возможности (https://habr.com/ru/articles/
|
||||||
# WireGuard
|
# WireGuard
|
||||||
# VpnClient
|
# VpnClient
|
||||||
# Proxy
|
# Proxy
|
||||||
|
# netsh
|
||||||
# OpenSSH
|
# OpenSSH
|
||||||
# WinRM
|
# WinRM
|
||||||
# PackageManagement
|
# PackageManagement
|
||||||
|
|
@ -4782,7 +4783,7 @@ $cmd.ExecuteNonQuery()
|
||||||
Get-Command -Module Wdac
|
Get-Command -Module Wdac
|
||||||
Get-OdbcDriver | ft # список установленных драйверов
|
Get-OdbcDriver | ft # список установленных драйверов
|
||||||
|
|
||||||
https://www.elastic.co/guide/en/elasticsearch/reference/current/sql-client-apps-ps1.html
|
Elasticsearch ODBC драйвер для доступа к данным Elasticsearch из Microsoft PowerShell (https://www.elastic.co/guide/en/elasticsearch/reference/current/sql-client-apps-ps1.html)
|
||||||
|
|
||||||
$connectstring = "DSN=Local Elasticsearch;"
|
$connectstring = "DSN=Local Elasticsearch;"
|
||||||
$sql = "SELECT * FROM library"
|
$sql = "SELECT * FROM library"
|
||||||
|
|
@ -4989,7 +4990,9 @@ Invoke-SNMPv3Walk -UserName lifailon -Target 192.168.3.100 -AuthSecret password
|
||||||
|
|
||||||
### Lextm.SharpSnmpLib
|
### Lextm.SharpSnmpLib
|
||||||
|
|
||||||
https://api.nuget.org/v3-flatcontainer/lextm.sharpsnmplib/12.5.2/lextm.sharpsnmplib.12.5.2.nupkg
|
Синтаксис: https://learn.microsoft.com/ru-ru/powershell/dsc/reference/resources/windows/fileresource?view=dsc-1.1
|
||||||
|
Download lib: https://api.nuget.org/v3-flatcontainer/lextm.sharpsnmplib/12.5.2/lextm.sharpsnmplib.12.5.2.nupkg
|
||||||
|
|
||||||
Add-Type -LiteralPath "$home\Desktop\lextm.sharpsnmplib-12.5.2\net471\SharpSnmpLib.dll"
|
Add-Type -LiteralPath "$home\Desktop\lextm.sharpsnmplib-12.5.2\net471\SharpSnmpLib.dll"
|
||||||
|
|
||||||
$port = 161
|
$port = 161
|
||||||
|
|
@ -5612,6 +5615,32 @@ $Credential = New-Object System.Management.Automation.PSCredential($user, $Secur
|
||||||
Invoke-RestMethod http://ifconfig.me/ip
|
Invoke-RestMethod http://ifconfig.me/ip
|
||||||
Invoke-RestMethod https://kinozal.tv/rss.xml
|
Invoke-RestMethod https://kinozal.tv/rss.xml
|
||||||
|
|
||||||
|
# netsh
|
||||||
|
|
||||||
|
### Proxy
|
||||||
|
|
||||||
|
netsh interface portproxy add v4tov4 listenport=8080 listenaddress=0.0.0.0 connectport=80 connectaddress=192.168.3.108
|
||||||
|
netsh interface portproxy show all
|
||||||
|
netsh interface portproxy delete v4tov4 listenport=8080 listenaddress=0.0.0.0
|
||||||
|
|
||||||
|
### Wlan
|
||||||
|
|
||||||
|
netsh wlan show profile # список сохраненны профилей Wi-Fi и паролей
|
||||||
|
netsh wlan show interfaces # хар-ки текущей сети (MAC, speed)
|
||||||
|
netsh wlan show profile SSID-Name-Network key=clear # очистить пароль
|
||||||
|
netsh wlan show networks # список видемых сетей
|
||||||
|
netsh wlan disconnect # отключиться от Wi-Fi
|
||||||
|
netsh wlan connect name="SSID-Name-Network" # подключиться
|
||||||
|
netsh wlan show drivers # драйвер Wi-Fi
|
||||||
|
netsh wlan set hostednetwork mode=allow ssid="WiFi-Test" key="password" # создание точки доступа Wi-Fi (SoftAP)
|
||||||
|
|
||||||
|
### Firewall
|
||||||
|
|
||||||
|
netsh advfirewall set allprofiles state off # отключить fw
|
||||||
|
netsh advfirewall reset # сбросить настройки
|
||||||
|
netsh advfirewall firewall add rule name="Open Remote Desktop" protocol=TCP dir=in localport=3389 action=allow # открыть порт 3389
|
||||||
|
netsh advfirewall firewall add rule name="All ICMP V4" dir=in action=allow protocol=icmpv4 # открыть icmp
|
||||||
|
|
||||||
# OpenSSH
|
# OpenSSH
|
||||||
|
|
||||||
Get-WindowsCapability -Online | ? Name -like 'OpenSSH.Client*'
|
Get-WindowsCapability -Online | ? Name -like 'OpenSSH.Client*'
|
||||||
|
|
@ -5882,7 +5911,7 @@ Get-Command -Module PSDesiredStateConfiguration
|
||||||
Get-DscLocalConfigurationManager
|
Get-DscLocalConfigurationManager
|
||||||
|
|
||||||
Get-DscResource
|
Get-DscResource
|
||||||
Get-DscResource -Name File -Syntax # https://learn.microsoft.com/ru-ru/powershell/dsc/reference/resources/windows/fileresource?view=dsc-1.1
|
Get-DscResource -Name File -Syntax # синтаксис (https://learn.microsoft.com/ru-ru/powershell/dsc/reference/resources/windows/fileresource?view=dsc-1.1)
|
||||||
|
|
||||||
Ensure = Present # настройка должна быть включена (каталог должен присутствовать, процесс должен быть запущен, если нет – создать, запустить)
|
Ensure = Present # настройка должна быть включена (каталог должен присутствовать, процесс должен быть запущен, если нет – создать, запустить)
|
||||||
Ensure = Absent # настройка должна быть выключена (каталога быть не должно, процесс не должен быть запущен, если нет – удалить, остановить)
|
Ensure = Absent # настройка должна быть выключена (каталога быть не должно, процесс не должен быть запущен, если нет – удалить, остановить)
|
||||||
|
|
@ -6442,6 +6471,8 @@ https://docs.chocolatey.org/en-us/guides/organizations/organizational-deployment
|
||||||
|
|
||||||
# GigaChat
|
# GigaChat
|
||||||
|
|
||||||
|
https://developers.sber.ru/gigachat/login
|
||||||
|
|
||||||
### 1. Установка сертификатов:
|
### 1. Установка сертификатов:
|
||||||
|
|
||||||
Invoke-WebRequest "https://gu-st.ru/content/lending/russian_trusted_root_ca_pem.crt" -OutFile "$home\Downloads\russian_trusted_root_ca.cer" # скачать сертификат минцифры
|
Invoke-WebRequest "https://gu-st.ru/content/lending/russian_trusted_root_ca_pem.crt" -OutFile "$home\Downloads\russian_trusted_root_ca.cer" # скачать сертификат минцифры
|
||||||
|
|
@ -6928,7 +6959,7 @@ curl -s "https://videocdn.tv/api/$ep?api_token=$token&field=kinopoisk_id&query=$
|
||||||
|
|
||||||
@BotFather (https://t.me/BotFather) /newbot
|
@BotFather (https://t.me/BotFather) /newbot
|
||||||
|
|
||||||
https://api.telegram.org/bot<token>/<endpoint>
|
Format: https://api.telegram.org/bot<token>/<endpoint>
|
||||||
|
|
||||||
https://core.telegram.org/bots/api#getupdates
|
https://core.telegram.org/bots/api#getupdates
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue