Difference between revisions of "Powershell"

From TheBestLinux.com
Jump to navigation Jump to search
(Created page with " == Windows PowerShell Information == [http://www.dawgland.com/Enable_PowerShell/ Enabling PowerShell Script Execution] <br /><br />")
 
Line 3: Line 3:
 
[http://www.dawgland.com/Enable_PowerShell/ Enabling PowerShell Script Execution]
 
[http://www.dawgland.com/Enable_PowerShell/ Enabling PowerShell Script Execution]
 
<br /><br />
 
<br /><br />
 +
 +
 +
=== Miscellaneous PowerShell Commands ===
 +
Here are some of the PowerShell commands I use regularily to to manage Windows machines:
 +
<pre style="color:blue">
 +
 +
Create NEW Active Directory Domain Controller/AD DS:
 +
Install-WindowsFeature -Name AD-Domain-Services -IncludeManagementTools
 +
Install-ADDSForest -DomainName thebestlinux.net -DomainNetbiosName THEBESTLINUX -InstallDNS
 +
OTHER COMMANDS:
 +
Disable IPv6 on ALL NIC’s:
 +
Disable-NetAdapterBinding -Name Ethernet* -ComponentID ms_tcpip6
 +
Get-NetTCPConnection
 +
Get-NetConnectionProfile
 +
Get-NetAdapter
 +
Set-DnsClientServerAddress -InterfaceIndex 3 -ServerAddresses ("192.168.200.103","192.168.200.121","75.75.76.76")
 +
Install-Module PSWindowsUpdate
 +
Set-PSRepository
 +
Add-WUServiceManager -MicrosoftUpdate
 +
Get-WindowsUpdate
 +
Get-Service | findstr Admin
 +
sc queryex type=service state=all
 +
Get-ItemProperty HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\* | Select-Object DisplayName, DisplayVersion, Publisher, InstallDate | Format-Table -AutoSize
 +
Get-WindowsFeature
 +
Get-package | Select-Object Name,Version
 +
Get-WindowsUpdate -v
 +
Get-ItemProperty HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\* | Select-Object DisplayName, DisplayVersion, Publisher, InstallDate | Format-Table -AutoSize
 +
New-ADUser /?
 +
get-localuser
 +
get-roles
 +
Get-DnsServerResourceRecord dawgland.com
 +
Get-DnsServerQueryResolutionPolicy
 +
dcdiag /a
 +
CONFIRM ALL 5 Roles of Active Directory Servers are up and running!!!:
 +
Get-ADDomain dawgland.com | Format-Table PDCEmulator,RIDMaster,InfrastructureMaster
 +
Get-ADForest dawgland.com | Format-Table SchemaMaster,DomainNamingMaster
 +
 +
Get-DnsServerResourceRecord -ZoneName dawgland.com
 +
Get-NetConnectionProfile
 +
Get-NetTCPConnection
 +
Get-CimInstance -Class CIM_LogicalDisk
 +
Get-DiskFreeSpace
 +
Get-GPRegistryValue -Key HKEY_LOCAL_MACHINE
 +
Get-GPRegistryValue -Guid 31b2f340-016d-11d2-945f-00c04fb984f9 -Key HKEY_LOCAL_MACHINE
 +
Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0
 +
Import-Module GroupPolicy -verbose
 +
<br /><br />
 +
</pre>

Revision as of 07:32, 17 October 2022

Windows PowerShell Information

Enabling PowerShell Script Execution


Miscellaneous PowerShell Commands

Here are some of the PowerShell commands I use regularily to to manage Windows machines:


Create NEW Active Directory Domain Controller/AD DS:
Install-WindowsFeature -Name AD-Domain-Services -IncludeManagementTools
Install-ADDSForest -DomainName thebestlinux.net -DomainNetbiosName THEBESTLINUX -InstallDNS
OTHER COMMANDS:
Disable IPv6 on ALL NIC’s:
Disable-NetAdapterBinding -Name Ethernet* -ComponentID ms_tcpip6
Get-NetTCPConnection
Get-NetConnectionProfile
Get-NetAdapter
Set-DnsClientServerAddress -InterfaceIndex 3 -ServerAddresses ("192.168.200.103","192.168.200.121","75.75.76.76")
Install-Module PSWindowsUpdate
Set-PSRepository
Add-WUServiceManager -MicrosoftUpdate
Get-WindowsUpdate
Get-Service | findstr Admin
sc queryex type=service state=all
Get-ItemProperty HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\* | Select-Object DisplayName, DisplayVersion, Publisher, InstallDate | Format-Table -AutoSize
Get-WindowsFeature
Get-package | Select-Object Name,Version
Get-WindowsUpdate -v
Get-ItemProperty HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\* | Select-Object DisplayName, DisplayVersion, Publisher, InstallDate | Format-Table -AutoSize
New-ADUser /?
get-localuser
get-roles
Get-DnsServerResourceRecord dawgland.com
Get-DnsServerQueryResolutionPolicy
dcdiag /a
CONFIRM ALL 5 Roles of Active Directory Servers are up and running!!!:
Get-ADDomain dawgland.com | Format-Table PDCEmulator,RIDMaster,InfrastructureMaster
Get-ADForest dawgland.com | Format-Table SchemaMaster,DomainNamingMaster

Get-DnsServerResourceRecord -ZoneName dawgland.com
Get-NetConnectionProfile
Get-NetTCPConnection
Get-CimInstance -Class CIM_LogicalDisk
Get-DiskFreeSpace
Get-GPRegistryValue -Key HKEY_LOCAL_MACHINE
Get-GPRegistryValue -Guid 31b2f340-016d-11d2-945f-00c04fb984f9 -Key HKEY_LOCAL_MACHINE
Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0
Import-Module GroupPolicy -verbose
<br /><br />