docs/powershell.md aktualisiert
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
## Basic-config
|
## Basic-config
|
||||||
|
|
||||||
Set-Password, Set-Hostname, IP-Config, DNS-Config
|
Set-Password, Set-Hostname, IP-Config, DNS-Config, Firewall
|
||||||
|
|
||||||
<details>
|
<details>
|
||||||
|
|
||||||
@@ -8,53 +8,59 @@
|
|||||||
|
|
||||||
#### Set-Password
|
#### Set-Password
|
||||||
|
|
||||||
> Command: Get-LocalUser -Name [Username] | Set-LocalUser -Password (ConvertTo-SecureString -AsPlainText [Password] -Force)
|
> Get-LocalUser -Name [Username] | Set-LocalUser -Password (ConvertTo-SecureString -AsPlainText [Password] -Force)
|
||||||
```ruby
|
```ruby
|
||||||
Get-LocalUser -Name 'Administrator' | Set-LocalUser -Password (ConvertTo-SecureString -AsPlainText 'Passw0rd' -Force)
|
Get-LocalUser -Name 'Administrator' | Set-LocalUser -Password (ConvertTo-SecureString -AsPlainText 'Passw0rd' -Force)
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Set-Hostname
|
#### Set-Hostname
|
||||||
|
|
||||||
> Command: Rename-Computer -NewName [Name der Maschine] -Restart -Force
|
> Rename-Computer -NewName [Name der Maschine] -Restart -Force
|
||||||
```ruby
|
```ruby
|
||||||
Rename-Computer -NewName 'DC01' -Restart -Force
|
Rename-Computer -NewName 'DC01' -Restart -Force
|
||||||
```
|
```
|
||||||
|
|
||||||
#### IP-Config
|
#### IP-Config
|
||||||
|
|
||||||
> Command: New-NetIPAddress -InterfaceIndex [Index des Interfaces] -AddressFamily [IPv4/IPv6] -IPAddress [IP-Adress] -PrefixLength [SNM / Prefix] -DefaultGateway [IP-Adresse des Default-Gateway]
|
> New-NetIPAddress -InterfaceIndex [Index des Interfaces] -AddressFamily [IPv4/IPv6] -IPAddress [IP-Adress] -PrefixLength [SNM / Prefix] -DefaultGateway [IP-Adresse des Default-Gateway]
|
||||||
```ruby
|
```ruby
|
||||||
New-NetIPAddress -InterfaceIndex 3 -AddressFamily IPv4 -IPAddress '172.16.7.100' -PrefixLength '255.255.255.0' -DefaultGateway '172.16.7.254'
|
New-NetIPAddress -InterfaceIndex 3 -AddressFamily IPv4 -IPAddress '172.16.7.100' -PrefixLength '255.255.255.0' -DefaultGateway '172.16.7.254'
|
||||||
```
|
```
|
||||||
|
|
||||||
#### DNS-Config
|
#### DNS-Config
|
||||||
|
|
||||||
> Command: Set-DnsClientServerAddress -InterfaceIndex [Index des Interfaces] -ServerAddresses ("[IP-Adresse primärer DNS]","[IP-Adresse sekundärer DNS]")
|
> Set-DnsClientServerAddress -InterfaceIndex [Index des Interfaces] -ServerAddresses ("[IP-Adresse primärer DNS]","[IP-Adresse sekundärer DNS]")
|
||||||
```ruby
|
```ruby
|
||||||
Set-DnsClientServerAddress -InterfaceIndex '3' -ServerAddresses ('172.16.7.11','172.16.7.12')
|
Set-DnsClientServerAddress -InterfaceIndex '3' -ServerAddresses ('172.16.7.11','172.16.7.12')
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### Firewall-on/off
|
||||||
|
|
||||||
|
> netsh advfirewall set allprofiles state [off/on]
|
||||||
|
```ruby
|
||||||
|
netsh advfirewall set allprofiles state off
|
||||||
|
```
|
||||||
|
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
## Interface Options
|
## Interface Options
|
||||||
|
|
||||||
Infos auslesen, IPv6 on/off, DHCPv6 on/off, Networkmode [Public,Private,Domain]
|
Infos auslesen, IPv6 on/off, DHCPv6 on/off, Networkmode [Public/Private/Domain]
|
||||||
|
|
||||||
<details>
|
<details>
|
||||||
|
|
||||||
<summary>Expand</summary>
|
<summary>Expand</summary>
|
||||||
|
|
||||||
#### Adapterinfos auslesen [Name/Index/Ip-Adress]
|
#### Adapterinfos auslesen [Name/Index/Ip-Adress]
|
||||||
IPv6 -AddressFamily 'IPv6'
|
|
||||||
IPv4 -AddressFamily 'IPv4'
|
|
||||||
|
|
||||||
|
> Get-NetIPInterface -AddressFamily [IPv4/6]
|
||||||
```ruby
|
```ruby
|
||||||
Get-NetIPInterface
|
Get-NetIPInterface
|
||||||
```
|
```
|
||||||
|
|
||||||
#### IPv6-an/abschalten
|
#### IPv6-an/abschalten
|
||||||
|
|
||||||
> Command: [Disable/Enable]-NetAdapterBinding -Name [Name der Netzwerkkarte] -ComponentID ms_tcpip6
|
> [Disable/Enable]-NetAdapterBinding -Name [Name der Netzwerkkarte] -ComponentID ms_tcpip6
|
||||||
```ruby
|
```ruby
|
||||||
Disable-NetAdapterBinding -Name 'eth0' -ComponentID ms_tcpip6
|
Disable-NetAdapterBinding -Name 'eth0' -ComponentID ms_tcpip6
|
||||||
```
|
```
|
||||||
@@ -64,18 +70,18 @@ Enable-NetAdapterBinding -Name 'eth0' -ComponentID ms_tcpip6
|
|||||||
|
|
||||||
#### IPv6-DHCP-abschalten
|
#### IPv6-DHCP-abschalten
|
||||||
|
|
||||||
> Command: Set-NetIPInterface -InterfaceAlias [Name der Netzwerkkarte] -AddressFamily [IPv4/IPv6] -Dhcp Disabled
|
> Set-NetIPInterface -InterfaceAlias [Name der Netzwerkkarte] -AddressFamily [IPv4/IPv6] -Dhcp Disabled
|
||||||
```ruby
|
```ruby
|
||||||
Set-NetIPInterface -InterfaceAlias 'Inside' -AddressFamily 'IPv6' -Dhcp Disabled
|
Set-NetIPInterface -InterfaceAlias 'Inside' -AddressFamily 'IPv6' -Dhcp Disabled
|
||||||
```
|
```
|
||||||
> Command: Set-NetIPInterface -InterfaceIndex [Index der Netzwerkkarte] -AddressFamily [IPv4/IPv6] -Dhcp Disabled
|
> Set-NetIPInterface -InterfaceIndex [Index der Netzwerkkarte] -AddressFamily [IPv4/IPv6] -Dhcp Disabled
|
||||||
```ruby
|
```ruby
|
||||||
Set-NetIPInterface -InterfaceIndex '3' -AddressFamily 'IPv6' -Dhcp Disabled
|
Set-NetIPInterface -InterfaceIndex '3' -AddressFamily 'IPv6' -Dhcp Disabled
|
||||||
```
|
```
|
||||||
|
|
||||||
## Set-Networkcard-to-private
|
## Set-Networkcard-to-private
|
||||||
Profil der Netzwerkkarte auf Privat umstellen (Firewall)
|
|
||||||
> Comman: Set-NetConnectionProfile -InterfaceIndex [Index der Netzwerkkarte] -NetworkCategory "Private"
|
> Set-NetConnectionProfile -InterfaceIndex [Index der Netzwerkkarte] -NetworkCategory [Public/Private/Domain]
|
||||||
```ruby
|
```ruby
|
||||||
Set-NetConnectionProfile -InterfaceIndex '3' -NetworkCategory 'Private'
|
Set-NetConnectionProfile -InterfaceIndex '3' -NetworkCategory 'Private'
|
||||||
```
|
```
|
||||||
@@ -88,14 +94,6 @@ Set-NetConnectionProfile -InterfaceIndex '3' -NetworkCategory 'Private'
|
|||||||
New-NetRoute -DestinationPrefix '172.16.0.0/20' -InterfaceIndex '7' -NextHop '172.16.X.254' -RouteMetric '1'
|
New-NetRoute -DestinationPrefix '172.16.0.0/20' -InterfaceIndex '7' -NextHop '172.16.X.254' -RouteMetric '1'
|
||||||
```
|
```
|
||||||
|
|
||||||
## Change-Serverrolle-im-AD
|
|
||||||
> Command: Move-ADDirectoryServerOperationMasterRole -Identity [Ziel-DC] -OperationMasterRole [Role]
|
|
||||||
|
|
||||||
> Rollen: SchemaMaster,RIDMaster,InfrastructureMaster,DomainNamingMaster,PDCEmulator
|
|
||||||
```ruby
|
|
||||||
Move-ADDirectoryServerOperationMasterRole -Identity 'DC01' -OperationMasterRole PDCEmulator
|
|
||||||
```
|
|
||||||
|
|
||||||
## Remote-Access
|
## Remote-Access
|
||||||
Read TrustedHosts
|
Read TrustedHosts
|
||||||
```ps
|
```ps
|
||||||
@@ -125,7 +123,20 @@ Invoke-Command –ComputerName [IP bzw. FQDN] –Credential [User] –Command {[
|
|||||||
Invoke-Command –ComputerName [IP bzw. FQDN] –Credential [User] –ScriptBlock {[Befehle]}
|
Invoke-Command –ComputerName [IP bzw. FQDN] –Credential [User] –ScriptBlock {[Befehle]}
|
||||||
```
|
```
|
||||||
|
|
||||||
## Add-User
|
## AD Set-Serverroll, Join-Domain, Add-User
|
||||||
|
|
||||||
|
<details>
|
||||||
|
|
||||||
|
<summary>Expand</summary>
|
||||||
|
|
||||||
|
#### Change-Serverrolle-im-AD
|
||||||
|
> Move-ADDirectoryServerOperationMasterRole -Identity [Ziel-DC] -OperationMasterRole [SchemaMaster/RIDMaster/InfrastructureMaster/DomainNamingMaster/PDCEmulator]
|
||||||
|
> Move-ADDirectoryServerOperationMasterRole -Identity [Ziel-DC] -OperationMasterRole [0/1/2/3/4]
|
||||||
|
```ruby
|
||||||
|
Move-ADDirectoryServerOperationMasterRole -Identity 'DC01' -OperationMasterRole PDCEmulator
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Add-User
|
||||||
New-ADUser -Name [Vor Nachname] `
|
New-ADUser -Name [Vor Nachname] `
|
||||||
-GivenName [Vorname] `
|
-GivenName [Vorname] `
|
||||||
-Surname [Nachname] `
|
-Surname [Nachname] `
|
||||||
@@ -139,6 +150,7 @@ Invoke-Command –ComputerName [IP bzw. FQDN] –Credential [User] –ScriptBloc
|
|||||||
New-ADUser -Name "John Doe" -GivenName "John" -Surname "Doe" -SamAccountName "jdoe" -UserPrincipalName "jdoe@yourdomain.com" -Path "OU=Users,DC=yourdomain,DC=com" -AccountPassword (ConvertTo-SecureString "P@ssword1" -AsPlainText -Force) -Enabled $true
|
New-ADUser -Name "John Doe" -GivenName "John" -Surname "Doe" -SamAccountName "jdoe" -UserPrincipalName "jdoe@yourdomain.com" -Path "OU=Users,DC=yourdomain,DC=com" -AccountPassword (ConvertTo-SecureString "P@ssword1" -AsPlainText -Force) -Enabled $true
|
||||||
```
|
```
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
> Command:
|
> Command:
|
||||||
```ruby
|
```ruby
|
||||||
|
|||||||
Reference in New Issue
Block a user