May 2024
M T W T F S S
 12345
6789101112
13141516171819
20212223242526
2728293031  

Categories

May 2024
M T W T F S S
 12345
6789101112
13141516171819
20212223242526
2728293031  

Windows 2012 Command

taskmgr
regedit
timedate.cpl
intl.cpl
sconfig.cmd

get-process

diskpart

Install DHCP SERVER Using PowerShell

PS C:\Users\Administrator> get-command -Module servermanager

CommandType Name ModuleName
———– —- ———-
Alias Add-WindowsFeature ServerManager
Alias Remove-WindowsFeature ServerManager
Function Disable-ServerManagerStandardUserRemoting ServerManager
Function Enable-ServerManagerStandardUserRemoting ServerManager
Cmdlet Get-WindowsFeature ServerManager
Cmdlet Install-WindowsFeature ServerManager
Cmdlet Uninstall-WindowsFeature ServerManager

PS C:\Users\Administrator> Add-WindowsFeature -IncludeAllSubFeature -Name DHCP, RSAT-DHCP

Success Restart Needed Exit Code Feature Result
——- ————– ——— ————–
True Yes SuccessRest… {DHCP Server, Remote Server Administration…
WARNING: You must restart this server to finish the installation process.
WARNING: Windows automatic updating is not enabled. To ensure that your newly-installed role or feature is
automatically updated, turn on Windows Update.

PS C:\Users\Administrator> Get-WindowsFeature *dhcp*

Display Name Name Install State
———— —- ————-
[X] DHCP Server DHCP InstallPending
[X] DHCP Server Tools RSAT-DHCP InstallPending

Get-WindowsFeature

Install-WindowsFeature DHCP -IncludeManagementTools -whatif
Add-WindowsFeature -IncludeAllSubFeature -Name DHCP, RSAT-DHCP

Remove Windows feature
PS C:\Users\Administrator> Remove-WindowsFeature -Name DHCP, RSAT-DHCP

Success Restart Needed Exit Code Feature Result
——- ————– ——— ————–
True Yes SuccessRest… {DHCP Server, Remote Server Administration…
WARNING: You must restart this server to finish the removal process.

How to Reboot Windows Server 2012
As you may have guessed, restarting Server 2012 is conceptually the same as shutting down. If you would like PowerShell to reboot the server then in place of ‘Stop’ use the verb ‘Restart’.

For occasions where you employ the shutdown command, then instead of typing -s, substitute -r.

# How to Reboot Server 2012 with PowerShell
Restart-Computer

# How to Reboot with the built-in command
Shutdown -r -m \\localhost

Employ PowerShell to Shutdown Windows Server 2012
If you are familiar with PowerShell’s cmdlets then you need a verb called ‘Stop’ (not shutdown), coupled with the noun ‘Computer’.

Launch PowerShell, type stop then tab, you should see Stop-Computer. If this flashy technique does not work, then just type this one simple command long-hand:

# PowerShell command to shutdown Windows Server 2012

Stop-Computer

shutdown utility. However, there is a little known switch to bring-up a GUI version of this command line utility.

# GUI method of using the built-in Shutdown command

Shutdown -i

Note: If you are going to use any of the Shutdown commands, the first switch to learn is -a. Shutdown -a meaning abort!

Pure Shutdown

I like to operate shutdown from within PowerShell.
# Shutdown the local Windows Server 2012 machine

Shutdown -s -m \\localhost

Setting an IP address

PS C:\Users\Administrator> Get-NetAdapter

Name InterfaceDescription ifIndex Status MacAddress LinkSpeed
—- ——————– ——- —— ———- ———
Ethernet0 Intel(R) 82574L Gigabit Network Conn… 12 Up 00-0C-29-3C-C0-2F 1 Gbps

PS C:\Users\Administrator>

Get-NetIPAddress -InterfaceIndex 12 -AddressFamily IPv4

To add the IP address use:

New-NetIPAddress -InterfaceIndex 12 -AddressFamily IPv4 -IPAddress 192.168.1.9 -PrefixLength 24

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>