header image

Archive for Windows 8 Server

Remember that yesterday I loaded the RSAT tools on to my Windows 8 server instance. This includes a PowerShell module that auto loads – like all Windows 8 modules on the PS module path

Start by looking at the GET commands

Get-Command -Module DhcpServer   get*

Get-DhcpServerAuditLog
Get-DhcpServerDatabase
Get-DhcpServerInDC
Get-DhcpServerSetting
Get-DhcpServerv4Binding
Get-DhcpServerv4Class
Get-DhcpServerv4DnsSetting
Get-DhcpServerv4ExclusionRange
Get-DhcpServerv4Failover
Get-DhcpServerv4Filter
Get-DhcpServerv4FilterList
Get-DhcpServerv4FreeIPAddress
Get-DhcpServerv4Lease
Get-DhcpServerv4OptionDefinition
Get-DhcpServerv4OptionValue
Get-DhcpServerv4Policy
Get-DhcpServerv4PolicyIPRange
Get-DhcpServerv4Reservation
Get-DhcpServerv4Scope
Get-DhcpServerv4ScopeStatistics
Get-DhcpServerv4Statistics
Get-DhcpServerv4Superscope
Get-DhcpServerv6Binding
Get-DhcpServerv6Class
Get-DhcpServerv6DnsSetting
Get-DhcpServerv6ExclusionRange
Get-DhcpServerv6FreeIPAddress
Get-DhcpServerv6Lease
Get-DhcpServerv6OptionDefinition
Get-DhcpServerv6OptionValue
Get-DhcpServerv6Reservation
Get-DhcpServerv6Scope
Get-DhcpServerv6ScopeStatistics
Get-DhcpServerv6StatelessStatis…
Get-DhcpServerv6StatelessStore
Get-DhcpServerv6Statistics
Get-DhcpServerVersion

 

This will keep us busy for a while and we haven’t looked at the other verbs!

Notice we don’t have a get-dhcpserver as such but we do have Get-DhcpServerVersion

 

PS> Get-DhcpServerVersion -ComputerName server02

MajorVersion : 6
MinorVersion : 1

 

PS> Get-WmiObject Win32_OperatingSystem -ComputerName server02 | fl Caption, version

Caption : Microsoft Windows Server 2008 R2 Datacenter
version : 6.1.7601

 

All we need is a bit of a wrapper function to decode the version numbers

 

also server settings

PS> Get-DhcpServerSetting -ComputerName server02

IsDomainJoined            : True
IsAuthorized              : True
DynamicBootp              : True
RestoreStatus             : False
ConflictDetectionAttempts : 0
NpsUnreachableAction      : Full
NapEnabled                : True
ActivatePolicies          :

 

Scopes are fairly important

 

PS> Get-DhcpServerv4Scope -ComputerName server02 | fl *

ScopeId          : 10.10.54.0
SubnetMask       : 255.255.255.0
StartRange       : 10.10.54.246
EndRange         : 10.10.54.250
ActivatePolicies :
Delay            : 0
Description      : Only used for new servers – before a static address is defined
LeaseDuration    : 04:00:00
MaxBootpClients  : 4294967295
Name             : NewServers
NapEnable        : True
NapProfile       :
State            : Active
SuperscopeName   :
Type             : Dhcp
ComputerName     :

 

There are IPv6 equivalent cmdlets as well

 

checking on free addresses

PS> Get-DhcpServerv4FreeIPAddress -ComputerName server02 -ScopeId "10.10.54.0"
10.10.54.246

 

PS> Get-DhcpServerv4FreeIPAddress -ComputerName server02 -ScopeId "10.10.54.0" -NumAddress 10
WARNING: The requested number of free IP addresses could not be found.
10.10.54.246
10.10.54.247
10.10.54.248
10.10.54.249
10.10.54.250

 

PS> Get-DhcpServerv4ScopeStatistics -ScopeId "10.10.54.0" -ComputerName server02 | fl *

ScopeId                       : 10.10.54.0
AddressesFree                 : 5
AddressesFreeOnPartnerServer  :
AddressesFreeOnThisServer     :
AddressesInUse                : 0
AddressesInUseOnPartnerServer :
AddressesInUseOnThisServer    :
PendingOffers                 : 0
PercentageInUse               : 0
ReservedAddress               : 0
SuperscopeName                :
ComputerName                  :

 

and finally

Get-DhcpServerv4Lease -ComputerName server02 -ScopeId "10.10.54.0"

will return the leases

under: PowerShell V3, Windows 8 Server

I added the RSAT tools using the server manager module

PS> Get-Command -Module servermanager

CommandType     Name
———–     —-
Alias           Add-WindowsFeature
Alias           Remove-WindowsFeature
Cmdlet          Get-WindowsFeature
Cmdlet          Install-WindowsFeature
Cmdlet          Uninstall-WindowsFeature

Notice the name changes Add/Remove are now aliases with the cmdlets as install/uninstall

Use

Install-WindowsFeature -Name RSAT -IncludeAllSubFeature –Restart

to force the restart.

PowerShell needs to be running as an elevated shell to add features

The server needs a reboot before the tools are available for use

These modules are added

ADDSDeployment
RemoteAccess
WebAdministration
DnsServer
ADRMSAdmin
DFSN
GroupPolicy
NFS
Hyper-V
DhcpServer
BitLocker
ActiveDirectory
NetworkLoadBalancingClusters

PS> Get-DnsServer -ComputerName server02 | select -ExpandProperty ServerZone

ZoneName                     ZoneType        IsAutoCreated   IsDsIntegrated  IsReverseLookupZone  IsSigned
——–                     ——–        ————-   ————–  ——————-  ——–
_msdcs.Manticore.org         Primary         False           True            False                False
0.in-addr.arpa               Primary         True            False           True                 False
127.in-addr.arpa             Primary         True            False           True                 False
255.in-addr.arpa             Primary         True            False           True                 False
54.10.10.in-addr.arpa        Primary         False           True            True                 False
Manticore.org                Primary         False           True            False                False
TrustAnchors                 Primary         False           True            False                False

This working against my Win 2008 R2 DNS server – cool

And DHCP

Get-DhcpServerv4Scope -ComputerName server02

And Hyper-V

Get-VMHost -ComputerName server02

and AD

Get-ADDomainController

All of these work against my Win 2008 R2 domain

There is a mass to dig through here

under: PowerShell V3, Windows 8 Server

DNS cmdlets in PowerShell 3

Posted by: | September 18, 2011 | 3 Comments |

There are a number of modules related to DNS

ModuleType Name
———- —-
Manifest   DnsClient
Manifest   DnsConfig
Binary     DnsLookup
Manifest   DnsNrpt

If we start with the DnsClient module we get these functions and cmdlets

Add-DnsClientNrptRule
Clear-DNSClientCache
Get-DNSClient
Get-DNSClientCache
Get-DnsClientEffectiveNrptPolicy
Get-DnsClientNrptGlobal
Get-DnsClientNrptRule
Get-DNSGlobalSettings
Get-DNSServerAddress
Remove-DnsClientNrptRule
Set-DNSClient
Set-DnsClientNrptGlobal
Set-DnsClientNrptRule
Set-DNSGlobalSettings
Resolve-DnsName

Knowing which DNS server the client is using

PS> Get-DNSServerAddress | select ElementName, Name

ElementName                                                 Name
———–                                                 —-
Virtual Wireless                                            192.168.2.1
isatap.{E962BF88-1194-44A8-B30B-A65A4772C812}               192.168.2.1
Virtual LAN                                                 10.10.54.201
isatap.{EA0AB201-1381-4643-A67D-72C9C8860860}               10.10.54.201
Loopback Pseudo-Interface 1                                 fec0:0:0:ffff::1
Loopback Pseudo-Interface 1                                 fec0:0:0:ffff::2
Loopback Pseudo-Interface 1                                 fec0:0:0:ffff::3

and what the client has cached

Get-DNSClientCache | select Name, data

Name                                                        data
—-                                                        —-
server02                                                    192.168.2.1
server02                                                    10.10.54.201
server02                                                    192.168.1.6
server02.manticore.org                                      192.168.2.1
server02.manticore.org                                      10.10.54.201
server02.manticore.org                                      192.168.1.6
watson.telemetry.microsoft.com

final one for the moment – is a replacement for nslookup

PS> Resolve-DnsName exch07

IP4Address   : 10.10.54.130
Name         : exch07.Manticore.org
Type         : A
CharacterSet : Unicode
Section      : Answer
DataLength   : 4
TTL          : 1200

under: PowerShell V3, Windows 8 Server

After building a PowerShell Windows 8 server I naturally started to look at PowerShell

Click the icon and it loads

PS C:\Users\Administrator> $psversiontable

Name                           Value
—-                           —–
PSVersion                      3.0
PSCompatibleVersions           {1.0, 2.0, 3.0}
BuildVersion                   6.2.8102.0
CLRVersion                     4.0.30319.17020
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.103
SerializationVersion           1.1.0.1

Compare with current details from PowerShell v2

PS> $psversiontable

Name                           Value
—-                           —–
CLRVersion                     2.0.50727.5446
BuildVersion                   6.1.7601.17514
PSVersion                      2.0
WSManStackVersion              2.0
PSCompatibleVersions           {1.0, 2.0}
SerializationVersion           1.1.0.1
PSRemotingProtocolVersion      2.1

 

The biggest change is that PowerShell 3 uses .NET 4.0 and WSMan has moved on a version.

Without loading any features or roles the following 56 modules are available

ADDeploymentWF                           AppLocker
Appx                                     BestPractices
BitsTransfer                             BranchCache
CimCmdlets                               ClusterAwareUpdating
DirectAccessClientComponents             Dism
DnsClient                                DnsConfig
DnsLookup                                DnsNrpt
FailoverClusters                         FileServer
iSCSI                                    KdsCmdlets
Microsoft.PowerShell.Core                Microsoft.PowerShell.Diagnostics
Microsoft.PowerShell.Host                Microsoft.PowerShell.Management
Microsoft.PowerShell.Security            Microsoft.PowerShell.Utility
Microsoft.WSMan.Management               MicrosoftiSCSITarget
MsDtc                                    NetAdapter
NetLbfo                                  NetQos
NetSwitchTeam                            NetTCPIP
netwnv                                   NetworkConnectivityStatus
NetworkSecurity                          NetworkTransition
PKIClient                                PrintManagement
PS_MMAgent                               PSDiagnostics
PSScheduledJob                           PSWorkflow
RDManagement                             ScheduledTasks
SecureBoot                               ServerManager
ServerManagerShell                       SmbShare
SmbWitness                               Storage
TelemetryManagement                      TroubleshootingPack
TrustedPlatformModule                    UserAccessLogging
Wdac                                     Whea

These modules are auto loaded when PowerShell starts

                                          ADDeploymentWF
AppLocker                                Appx
BestPractices                            BitsTransfer
BranchCache                              CimCmdlets
ClusterAwareUpdating                     DirectAccessClientComponents
Dism                                     DnsClient
DnsConfig                                DnsLookup
DnsNrpt                                  FailoverClusters
FileServer                               iSCSI
KdsCmdlets                               Microsoft.PowerShell.Core Microsoft.PowerShell.Diagnostics         Microsoft.PowerShell.Host
Microsoft.PowerShell.Management          Microsoft.PowerShell.Security
Microsoft.PowerShell.Utility             Microsoft.WSMan.Management
MicrosoftiSCSITarget                     MsDtc
NetAdapter                               NetLbfo
NetQos                                   NetSwitchTeam
NetTCPIP                                 netwnv
NetworkConnectivityStatus                NetworkSecurity
NetworkTransition                        PKIClient
PrintManagement                          PS_MMAgent
PSDiagnostics                            PSScheduledJob
PSWorkflow                               RDManagement
ScheduledTasks                           SecureBoot
ServerManager                            ServerManagerShell
SmbShare                                 SmbWitness
Storage                                  TelemetryManagement
TroubleshootingPack                      TrustedPlatformModule
UserAccessLogging                        Wdac
Whea

Thats all of them! 

To paraphrase a slogan from a well known software company – what do you want to automate today?

Remember – thats before we add any roles or features.

This going to be fun

under: PowerShell V3, Windows 8 Server

« Newer Posts

Categories