Thursday, July 23, 2015

Get serial number of server from within Windows

I was remotely connected (via RDP) to a server a thousand miles away for which I needed to get the serial number. The server is an HP 380 Gen9.

Neat trick using WMIC

from command line:
wmic /node:HOSTNAME bios get serialnumber
(I used "localhost" for the hostname)


Monday, July 20, 2015

Domain Controller, new domain, Windows 2012 r2 Core, part 2

See part 1 for the back story.


Here we establish a second domain controller for an existing domain that we set up in part 1.




Use Part1 to repeat steps 1 through 5


Verify your hostname and IP configuration are correct, primary DNS should be address of the first domain controller we installed in part 1.


To create additional domain controller for existing domain:
From PowerShell:


step 6.
#add computer to domain
add-computer -domain lab.local -credential (get-credential)
[enter credentials of domain admin]
restart-computer




step 7.
from PowerShell


Install-ADDSDomainController -DomainName lab.local -InstallDNS:$True –Credential (Get-Credential)
[enter domain admin credentials]
reboot will occur.





Domain Controller, New Domain, Server 2012 r2 Core, Part 1.

I am setting up a test lab for "Skype for Business 2015". To proceed with testing I wanted a new lab consisting of:


2x Domain Controller (w/ DNS) - Windows 2012 R2 Core
1x SQL server 2012 on Windows 2012 (not r2, W/ GUI)
1x Skype for Business 2015 (Lync) server on Windows 2012
1x RDS server (as client) on server 2008R2


As a guide to configuring the Domain Controllers, below are the commands and Powershell commands that I use.


*THIS IS ONLY FOR A LAB ENVIRONMENT! I would not recommend this for a production environment*


Let me preface this by saying that all of these commands are not mandatory and this is not a secure installation.  I like to disable IP v6 and all related components in my lab environment and disable the firewall.


Part 1. First domain controller, assuming a completely vanilla installation


Step 1.
Use SCONFIG to configure:
IP address, Subnet mask
defaut gateway address
DNS address
turn on (enable) remote desktop
computer name (reboot after)


step 2. disable ip6 components
From command line:
*test computer name and IP address:
hostname
ipconfig /all


netsh int ipv6 isatap set state disabled
netsh int ipv6 6to4 set state disabled
netsh int teredo set state disable


step 3. disable IP Helper service
From Powershell:
# PowerShell cmdlet to list services that are running
Get-Service * | Where-Object {$_.Status -eq "Stopped"}



#disable "IP Helper" service
set-service iphlpsvc -startuptype disabled
stop-service iphlpsvc


step 4A. disable IPv6 on adapter. on a fresh install the only adapter is called "Ethernet"


Get-NetAdapterBinding -InterfaceAlias Ethernet | Select-Object Name,DisplayName,ComponentID
Disable-NetAdapterBinding -InterfaceAlias Ethernet -ComponentID ms_tcpip6


step 4B. disable firewall
Get-NetFirewallProfile | Set-NetFirewallProfile -enabled false


step 5. install AD services (does not make a domain controller)
Install-WindowsFeature -Name AD-Domain-Services



step 6  (basic commands, accepts defaults during AD install
$Password = ConvertTo-SecureString -AsPlainText -String MyRetoreModePassword -Force
Install-ADDSForest -DomainName lab.local -SafeModeAdministratorPassword $Password -InstallDns



(additional command to append to previous command, if required/desired to change)

-DomainNetbiosName lab -DomainMode Win2012R2 -ForestMode Win2012R2 -DatabasePath "%SYSTEMROOT%\NTDS" `
-LogPath "%SYSTEMROOT%\NTDS" -SysvolPath "%SYSTEMROOT%\SYSVOL" -NoRebootOnCompletion -Force



#Step 5
Restart-Computer -Force





This should complete your first DC installation. See part 2 for installation of the second domain controller.