Difference between revisions of "Windows Server Powershell Commands"

From DFWLPiki
Jump to: navigation, search
Line 1: Line 1:
 
[[Category:Windows]]
 
[[Category:Windows]]
 +
Create new Network Team
 +
Get-NetAdapter
 +
New-NetLBFOTeam Team0 NIC1, NIC2
 
Installing Dell Openmanage on Windows Server Core
 
Installing Dell Openmanage on Windows Server Core
 
  msiexec /i SysMgmt.msi
 
  msiexec /i SysMgmt.msi

Revision as of 19:08, 4 March 2019

Create new Network Team

Get-NetAdapter
New-NetLBFOTeam Team0 NIC1, NIC2

Installing Dell Openmanage on Windows Server Core

msiexec /i SysMgmt.msi

Relocating Domain FSMO Roles

Move-ADDirectoryServerOperationMasterRole -Identity SERVERNAME -OperationMasterRole 0,1,2,3,4

Verify the current WSUS Updates source for the client

REG QUERY "HKLM\Software\Policies\Microsoft\Windows\WindowsUpdate"

Removing a computer object from the AD

Remove-ADComputer -Identity "ComputerName"

Deleting partitions that appear to be undeletable

diskpart
list disk
select disk n
list partition
select partition n
delete partition override
exit

Find out about shutdown events:

Get-EventLog System | Where-Object {$_.EventID -eq "1074" -or $_.EventID -eq "6008" -or $_.EventID -eq "1076"} | ft Machinename, TimeWritten, UserName, EventID, Message -AutoSize -Wrap

Running Windows Backup:

wbadmin start backup -backuptarget:D: -include:C: -allcritical -quiet
wbadmin get versions

Equivalent of 'grep'ing in Unix:

netstat -p TCP | Select-String -Pattern 3389

Joining a domain:

Add-Computer -Credential corp\administrator -DomainName corp.domain.com
Add-Computer -Credential corp\administrator -DomainName corp.domain.com -OUPath 'ou=Desktops,dc=corp,dc=domain,dc=com'
Add-Computer -Credential corp\administrator -DomainName corp.domain.com -OUPath 'ou=Servers,dc=corp,dc=domain,dc=com' -NewName ServerName

List all Possible windows features

Get-WindowsFeature

Installing SNMP: (and it will also install SNMP-Service too)

Install-WindowsFeature SNMP-WMI-Provider

Installing Windows Backup Service

Install-WindowsFeature Windows-Server-Backups
Install-WindowsFeature SNMP-WMI-Provider,  Windows-Server-Backup

Installing .net 3.5 (mount the Server 2012 DVD first)

Install-WindowsFeature –name NET-Framework-Core –source D:\sources\sxs

Preparing for MS Exchange Server 2013

Install-WindowsFeature Server-Media-Foundation, Web-Dyn-Compression, Web-WMI, Web-Client-Auth, Web-Http-Redirect, Web-Http-Tracing, Web-Request-Monitor, 

Preparing for MS Systems Center 2012 (mount the Server 2012 DVD first)

Install-WindowsFeature SNMP-WMI-Provider,  Windows-Server-Backup,  Web-Server,  Web-Metabase,  Web-ASP,  Web-Windows-Auth, Web-Static-Content,  Web-Default-Doc,  Web-Digest-Auth, Web-Dir-Browsing,  Web-Http-Errors,  Web-Http-Logging, Web-Request-Monitor,  Web-Filtering,  Web-Stat-Compression,  Web-Mgmt-Console,  Web-Asp-Net45, Web-CGI,  Web-ISAPI-Ext, NET-WCF-HTTP-Activation45, Web-Asp-Net -source E:\sources\sxs

Windows Update Client check in to WSUS server

wuauclt /detectnow

Windows Update Client has not checked into server in a long time but client is online

wuauclt /resetauthorization /detectnow

Verify WSUS client Settings:

REG QUERY "HKLM\Software\Policies\Microsoft\Windows\WindowsUpdate"

Extending a file system, such as after you extend the disk within VMware and you want to avoid logging onto the system to finish the file system extend

 "rescan" | diskpart
 $MaxSize = (Get-PartitionSupportedSize -DriveLetter d).sizeMax
 Resize-Partition -DriveLetter d -Size $MaxSize

Shrinking a file system might give an error about not enough disk space, so defrag it first:

defrag -c -w -v


Below are deprecated versions of commands:

Print out all available features:

PS C:\Windows\system32> dism.exe /online /get-features

Install Windows Backup Service:

PS C:\Windows\system32> dism.exe /online /enable-feature /featurename:WindowsServerBackup

Install .net 3.5. There is sometimes an error dectecting the source files, so we specify the CD sources instead.

PS C:\Windows\system32> dism.exe /online /enable-feature /all /featurename:NetFX3 /Source:D:\sources\sxs