docs/powershell.md aktualisiert

This commit is contained in:
2024-10-24 09:47:50 +02:00
parent 1f088b9838
commit 49185002fc

View File

@@ -1,28 +1,69 @@
## Interface
## Basic-config
> Command: Get-NetIPInterface -AddressFamily [IPv6/IPv4]
```ruby
Get-NetIPInterface -AddressFamily 'IPv6'
```
Set-Password, Set-Hostname, IP-Config, DNS-Config
## IPv6
<details>
<summary>IPv6-an/abschalten</summary>
<summary>Expand</summary>
#### Set-Password
> Command: Get-LocalUser -Name [Username] | Set-LocalUser -Password (ConvertTo-SecureString -AsPlainText [Password] -Force)
```ruby
Get-LocalUser -Name 'Administrator' | Set-LocalUser -Password (ConvertTo-SecureString -AsPlainText 'Passw0rd' -Force)
```
#### Set-Hostname
> Command: Rename-Computer -NewName [Name der Maschine] -Restart -Force
```ruby
Rename-Computer -NewName 'DC01' -Restart -Force
```
#### IP-Config
> Command: New-NetIPAddress -InterfaceIndex [Index des Interfaces] -AddressFamily [IPv4/IPv6] -IPAddress [IP-Adress] -PrefixLength [SNM / Prefix] -DefaultGateway [IP-Adresse des Default-Gateway]
```ruby
New-NetIPAddress -InterfaceIndex 3 -AddressFamily IPv4 -IPAddress '172.16.7.100' -PrefixLength '255.255.255.0' -DefaultGateway '172.16.7.254'
```
#### DNS-Config
> Command: Set-DnsClientServerAddress -InterfaceIndex [Index des Interfaces] -ServerAddresses ("[IP-Adresse primärer DNS]","[IP-Adresse sekundärer DNS]")
```ruby
Set-DnsClientServerAddress -InterfaceIndex '3' -ServerAddresses ('172.16.7.11','172.16.7.12')
```
</details>
## Interface Options
Infos auslesen, IPv6 on/off, DHCPv6 on/off, Networkmode [Public,Private,Domain]
<details>
<summary>Expand</summary>
#### Adapterinfos auslesen [Name/Index/Ip-Adress]
IPv6 -AddressFamily 'IPv6'
IPv4 -AddressFamily 'IPv4'
```ruby
Get-NetIPInterface
```
#### IPv6-an/abschalten
Schaltet IPv6 komplett ab!
> Command: [Disable/Enable]-NetAdapterBinding -Name [Name der Netzwerkkarte] -ComponentID ms_tcpip6
```ruby
Disable-NetAdapterBinding -Name 'eth0' -ComponentID ms_tcpip6
```
```ruby
Enable-NetAdapterBinding -Name 'eth0' -ComponentID ms_tcpip6
```
### IPv6-DHCP-abschalten
<details>
#### IPv6-DHCP-abschalten
<summary>IPv6-DHCP-abschalten</summary>
Nur DHCPv6 abschalten
> Command: Set-NetIPInterface -InterfaceAlias [Name der Netzwerkkarte] -AddressFamily [IPv4/IPv6] -Dhcp Disabled
```ruby
Set-NetIPInterface -InterfaceAlias 'Inside' -AddressFamily 'IPv6' -Dhcp Disabled
@@ -32,9 +73,6 @@ Set-NetIPInterface -InterfaceAlias 'Inside' -AddressFamily 'IPv6' -Dhcp Disabled
Set-NetIPInterface -InterfaceIndex '3' -AddressFamily 'IPv6' -Dhcp Disabled
```
</details>
</details>
## Set-Networkcard-to-private
Profil der Netzwerkkarte auf Privat umstellen (Firewall)
> Comman: Set-NetConnectionProfile -InterfaceIndex [Index der Netzwerkkarte] -NetworkCategory "Private"
@@ -42,6 +80,8 @@ Profil der Netzwerkkarte auf Privat umstellen (Firewall)
Set-NetConnectionProfile -InterfaceIndex '3' -NetworkCategory 'Private'
```
</details>
## Add-Route
> Command: New-NetRoute -DestinationPrefix [Subnet] -InterfaceIndex [Index der Netzwerkkarte] -NextHop [IP-Adress] -RouteMetric [Metric]
```ruby