Files
Gl-Komp-IT-Sys/docs/powershell.md

3.2 KiB
Raw Blame History

Interface

Command: Get-NetIPInterface -AddressFamily [IPv6/IPv4]

Get-NetIPInterface -AddressFamily 'IPv6'

IPv6

IPv6-an/abschalten

Schaltet IPv6 komplett ab!

Command: [Disable/Enable]-NetAdapterBinding -Name [Name der Netzwerkkarte] -ComponentID ms_tcpip6

Disable-NetAdapterBinding -Name 'eth0' -ComponentID ms_tcpip6

IPv6-DHCP-abschalten

IPv6-DHCP-abschalten

Nur DHCPv6 abschalten

Command: Set-NetIPInterface -InterfaceAlias [Name der Netzwerkkarte] -AddressFamily [IPv4/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 '3' -AddressFamily 'IPv6' -Dhcp Disabled

Set-Networkcard-to-private

Profil der Netzwerkkarte auf Privat umstellen (Firewall)

Comman: Set-NetConnectionProfile -InterfaceIndex [Index der Netzwerkkarte] -NetworkCategory "Private"

Set-NetConnectionProfile -InterfaceIndex '3' -NetworkCategory 'Private'

Add-Route

Command: New-NetRoute -DestinationPrefix [Subnet] -InterfaceIndex [Index der Netzwerkkarte] -NextHop [IP-Adress] -RouteMetric [Metric]

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

Move-ADDirectoryServerOperationMasterRole -Identity 'DC01' -OperationMasterRole PDCEmulator

Remote-Access

Read TrustedHosts

Get-Item WSMan:localhost\client\TrustedHosts

Set TrustedHost

Command: Set-Item WSMan:localhost\client\TrustedHosts Value '[IP bzw. hostname]'

Command: Set-Item WSMan:localhost\client\TrustedHosts Value '[IP bzw. hostname],[IP bzw. hostname]'

Set-Item WSMan:localhost\client\TrustedHosts Value '172.16.7.254'

Activate Remote-PS

Enable-PsRemoting

Remote PS Execute

Remote befehle oder scirptblöcke ausführen

Command: Invoke-Command ComputerName [IP bzw. FQDN] Credential [User] Command {[Befehl]}

Command: Invoke-Command ComputerName [IP bzw. FQDN] Credential [User] ScriptBlock {[Befehle]}

Invoke-Command ComputerName [IP bzw. FQDN] Credential [User] Command {[Befehl]}
Invoke-Command ComputerName [IP bzw. FQDN] Credential [User] ScriptBlock {[Befehle]}

Add-User

New-ADUser -Name [Vor Nachname] `
-GivenName [Vorname] `
-Surname [Nachname] `
-SamAccountName [Anmeldename] `
-UserPrincipalName [Anmedldename@domain.tld] `
-Path "OU=Users,DC=yourdomain,DC=com" `
-AccountPassword (ConvertTo-SecureString [Passw0rd] -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

Command: