Windows Server Administration Questions
Operating and maintaining Windows Server hosts and the roles they run: installing and managing server roles and features (Server Manager, PowerShell), building a production-ready server from first boot, Windows service configuration, startup types and dependencies, IIS web hosting, application pools and TLS bindings, Remote Desktop Services and administrative remote access, print services, NTFS and SMB share permissions, DFS namespaces, folder redirection and roaming profiles, Failover Clustering and clustered file services, Windows performance counters, Event Viewer diagnosis and event collection, PowerShell administration and remoting at scale, Just Enough Administration, backup and recovery of application and file servers, servicing channels and lifecycles across Windows Server releases including 2025, running WSUS (deprecated but still supported) or ConfigMgr as the Windows update infrastructure, and boot or offline recovery. Windows counterpart to Linux administration, often in mixed estates. Ground covered elsewhere: Active Directory domains and Group Policy, DNS and DHCP service design, identity and privileged-access models, security incident response, host security hardening baselines, and patch cadence, rollout rings and patch compliance.
Explain the Windows service startup types and, for each, give an example of a service where it is the right choice and why (boot time, dependency order, security).
Sample Answer
Direct answer
A Windows service has one start type that tells the Service Control Manager (SCM, the component that starts and supervises services) when to start it. The service start types are Automatic, Automatic (Delayed Start), Manual and Disabled. Drivers add two more, Boot and System. A trigger can start a service on an event instead of at boot. Pick by asking three questions: must it be running before anyone uses the server, what must start first, and does it widen the attack surface (the set of ways an attacker could reach the machine, to which every running or startable network-facing service adds) if left available.
The types and where each fits
| Start type | What it does | Example of a right choice and why |
|---|---|---|
| Automatic | Started by the SCM during system startup, even if nobody signs in | The database engine behind an application: clients expect it at boot (boot time) |
| Automatic (Delayed Start) | Starts a short time after the other automatic services have started | A backup or monitoring agent that is not needed to serve users: it keeps the boot-time rush for services that matter (boot time) |
| Manual | Started only when a user, an application or another service asks for it | A rarely used administrative service, or a helper that a dependent service launches on demand (dependency order) |
| Disabled | Cannot be started by a user or application | Print Spooler on a server that never prints: nothing can start it, which shrinks the attack surface (security) |
| Boot and System | Device drivers only. Boot drivers are loaded by the system loader before the kernel is running; System drivers are loaded while the kernel is initializing, before ordinary services start | A storage controller driver the operating system needs before it can read its own disk |
These are recommendations for a typical server, not a statement of what any service is set to by default, so verify against your build.
Dependencies change what start type means
Dependency order overrides the start type of the thing it depends on. Learn states that if an automatically started service depends on a manually started one, the manual service is also started automatically at startup. Disabling a dependency has the opposite effect: Learn's Netlogon example shows the Workstation service set to Disabled, so it stayed stopped, and every service that depended on it failed to start. Before disabling anything, list what depends on it with Get-Service <name> -DependentServices.
Triggers
A trigger starts a service when an event occurs, such as a device arrival or a domain join, rather than at boot. Learn's sc qtriggerinfo w32time example shows the Windows Time service started on domain join and stopped on leaving the domain. Its output:
C:\>sc qtriggerinfo w32time
[SC] QueryServiceConfig2 SUCCESS
SERVICE_NAME: w32time
START SERVICE
DOMAIN JOINED STATUS : 1ce20aba-9851-4421-9430-1ddeb766e809 [DOMAIN JOINED]
STOP SERVICE
DOMAIN JOINED STATUS : ddaf516e-58c2-4866-9574-c3b615d42ea1 [NOT DOMAIN JOINED]
Each trigger entry has an action (START SERVICE or STOP SERVICE), an event type (DOMAIN JOINED STATUS) and the specific condition in brackets. Run the same command against your own service to see whether it has any triggers. A trigger replaces always-on start for a service that only matters when an event occurs. Query with sc.exe qtriggerinfo <name>.
Setting and auditing
Set-Service -Name BITS -StartupType Automatic # Automatic, Manual or Disabled
Set-Service -Name BITS -StartupType AutomaticDelayedStart # PowerShell 6 and later only
sc.exe config BITS start= delayed-auto # delayed start from any shell, including Windows PowerShell 5.1
Get-CimInstance Win32_Service |
Group-Object StartMode | Select-Object Name, Count
Get-CimInstance Win32_Service -Filter "StartMode='Auto' AND State<>'Running'" |
Select-Object Name, ExitCode, DelayedAutoStart
Set-Service -StartupType AutomaticDelayedStartis accepted in PowerShell 6 and later. Windows PowerShell 5.1 accepts only Boot, System, Automatic, Manual and Disabled, so usesc.exe config ... start= delayed-autothere.Win32_Servicehas no separateStartModevalue for delayed start. TheDelayedAutoStartproperty carries it, on Windows Server 2016 and later.sc.exe configrequires a space after the equals sign (start= auto), or the command fails.- The last query is a boot health check: services that are meant to run but are not, with their exit codes.
Win32_Serviceis the CIM class (the standard management data model thatGet-CimInstancequeries) that describes each service. ItsStartModeproperty is one of Boot, System, Auto, Manual or Disabled.
Reading the audit output. Illustrative output of the first audit query (the counts will differ per server):
Name Count
---- -----
Auto 74
Manual 131
Disabled 12
Each row says how many services use that start mode. Illustrative output of the boot health check (the last query), laid out the way Format-Table prints it (column widths follow the longest value, numbers and booleans right-aligned):
Name ExitCode DelayedAutoStart
---- -------- ----------------
BITS 0 True
MyAgent 1066 False
BITS is set to start automatically but is not running yet: exit code 0 means no error, and DelayedAutoStart of True means it may simply still be waiting its turn after boot, so check how long the server has been up before treating it as a fault. MyAgent has exit code 1066, which Learn defines as ERROR_SERVICE_SPECIFIC_ERROR: the service failed with an error of its own, and its details are in the ServiceSpecificExitCode property, so that is where you look next.
Worked example: a four-service server
| Service | Choice | Reason |
|---|---|---|
| Application database engine | Automatic | Clients need it at boot |
| Application web tier | Automatic, declared dependent on the database engine | The SCM orders them, so the web tier never starts first |
| Monitoring agent | Automatic (Delayed Start) | Not needed to serve users, and it does not compete at boot |
| Print Spooler | Disabled | The server never prints, and a disabled service cannot be launched by anyone |
Pitfalls
- Making everything Automatic: slower boots and more exposed surface.
- Using Delayed Start as a fix for an ordering bug instead of declaring the dependency.
- Disabling a service without checking its dependents.
- Changing a service's start type but not its dependencies, so the next reboot behaves differently from the one you tested.
You have just built a new Windows Server and the team needs to manage it over Remote Desktop, but only from the management subnet 10.10.0.0/16 and only by clients that authenticate before a session is created. How do you set that up, and what else has to be true for remote access to work?
Sample Answer
Direct answer
Four settings, then a test from both sides. (1) Turn Remote Desktop on (registry value fDenyTSConnections = 0, where the registry is Windows' database of settings and a value is one named setting in it; or use Server Manager). (2) Require Network Level Authentication (NLA), which makes the client authenticate before the server builds a session, so unauthenticated clients never get a desktop. (3) Scope the built-in Remote Desktop Windows Firewall rule group so it only accepts the management subnet 10.10.0.0/16. (4) Make sure the right people are allowed in: members of the local Administrators group can already connect, and anyone else needs to be in Remote Desktop Users. Remote access also depends on the Remote Desktop Services service (TermService, the service name Windows uses for it) running and listening on port 3389, a network path that carries 3389 from the management subnet, and no Group Policy overriding your settings.
Setup
# 1. Allow Remote Desktop connections (0 = allow, 1 = deny)
Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server' -Name fDenyTSConnections -Value 0
# 2. Require Network Level Authentication on the RDP listener
Get-CimInstance -Namespace root/cimv2/TerminalServices -ClassName Win32_TSGeneralSetting |
Where-Object TerminalName -eq 'RDP-Tcp' |
Invoke-CimMethod -MethodName SetUserAuthenticationRequired -Arguments @{ UserAuthenticationRequired = 1 }
# 3. Enable the built-in Remote Desktop rules, but only for the management subnet
Get-NetFirewallRule -DisplayGroup 'Remote Desktop' |
Set-NetFirewallRule -Enabled True -RemoteAddress 10.10.0.0/16
# 4. Let the server-admin group in (Administrators can already connect)
Add-LocalGroupMember -Group 'Remote Desktop Users' -Member 'CONTOSO\ServerAdmins'
The registry value lives under HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server, and -RemoteAddress accepts a subnet in prefix notation such as 10.10.0.0/16. The number after the slash says how many of the address's 32 bits are fixed. In 10.10.0.0/16 the first 16 bits (10.10) are fixed and the last 16 can be anything, so the range is 10.10.0.0 to 10.10.255.255, which is 2^16 = 65,536 addresses. A client at 10.10.4.20 is inside the range; 10.11.4.20 and 192.168.1.5 are outside it.
Step 2 is the least obvious line. The Remote Desktop settings are exposed through WMI (Windows Management Instrumentation, Windows' built-in management interface), which the CIM cmdlets query. Get-CimInstance ... Win32_TSGeneralSetting returns one settings object per listener, and Where-Object TerminalName -eq 'RDP-Tcp' keeps the one for the standard RDP listener. Invoke-CimMethod -MethodName SetUserAuthenticationRequired calls the method that sets that object's UserAuthenticationRequired property, and UserAuthenticationRequired = 1 means authenticate at connection time, which is NLA. The RDP listener uses port 3389 over both TCP and UDP, and the built-in group covers both, which is why the scoping is applied to every rule in the group rather than to one.
What else has to be true
- The service is up and listening:
TermServicerunning and bound to port 3389 (netstat -ano | find "3389", then match the PID, the process ID number that Windows gives each running program, toTermServicewithtasklist /svc). - No policy overrides you. If
fDenyTSConnectionsor the NLA setting keeps reverting, a Group Policy object is overriding the local value (Microsoft documents a policy-level copy offDenyTSConnections, and WMI exposes which source set the NLA value). To see the source, runGet-CimInstance -Namespace root/cimv2/TerminalServices -ClassName Win32_TSGeneralSetting | Where-Object TerminalName -eq 'RDP-Tcp' | Select-Object UserAuthenticationRequired, PolicySourceUserAuthenticationRequired. The second property reads 0 when the server's own setting is in force, 1 when Group Policy set it, and 2 when it is the default. A 1 means the value will keep reverting until you change the GPO. Fix it in the GPO, not on the server. - The user is permitted: Administrators, or members of Remote Desktop Users, and the account is not locked out.
- The path is open: any network firewall between the management subnet and the server must also allow 3389 from
10.10.0.0/16. Host firewall scoping is only one layer. - The client supports NLA. Older clients that cannot do NLA will be refused, which is the intent; do not turn NLA off to accommodate them.
- No broader rule exists. Another enabled inbound allow rule that matches port 3389 would let other networks in despite your scoped group. List them:
Get-NetFirewallRule -Direction Inbound -Enabled True -Action Allow | Get-NetFirewallPortFilter | Where-Object LocalPort -eq 3389.
Verify from both sides
# From a host inside 10.10.0.0/16: should succeed
Test-NetConnection -ComputerName newserver -Port 3389 -InformationLevel Detailed
# From a host outside that subnet: should fail (TcpTestSucceeded : False)
Test-NetConnection -ComputerName newserver -Port 3389
A successful detailed result looks like this (abbreviated, with illustrative addresses; Microsoft's Test-NetConnection examples show the full field list):
ComputerName : newserver
RemoteAddress : 10.10.1.25
RemotePort : 3389
InterfaceAlias : Ethernet
SourceAddress : 10.10.4.20
TcpTestSucceeded : True
TcpTestSucceeded is the line that matters. True means the host completed a TCP connection to port 3389, so the firewall let it through. From a host outside 10.10.0.0/16 the same command ends with TcpTestSucceeded : False, which is the result you want there. Note that this tests the network path only; a real RDP sign-in additionally needs NLA and the user's permission.
On the server, Get-NetFirewallRule -DisplayGroup 'Remote Desktop' | Get-NetFirewallAddressFilter shows the remote address of each rule as 10.10.0.0/16.
Trade-offs and pitfalls
- Scope by address and require NLA together. NLA stops unauthenticated clients from consuming a session; the address scope stops the rest of the network from even reaching the login. Either alone is weaker.
- Do not expose 3389 to the internet. Put administrative access behind a VPN or a gateway; the subnet restriction here assumes the management network is already trusted and segmented.
- Disabling the firewall to "see if that fixes it" removes the scope and is how this restriction gets lost in practice; test with the rule, not without it.
- Use a group, not individual accounts, for Remote Desktop Users, so access follows role changes.
An IIS application returns intermittent HTTP 500 errors. Its application pool runs under a custom service account. How do you narrow down whether this is permissions, pool recycling, resource exhaustion or an application bug, and what do you fix first?
Sample Answer
Direct answer
Do not guess among the four causes: make the logs sort the 500s for you. IIS records a status, a substatus and a Windows error code for every request. Group the 500s by substatus, Windows error code, URL and hour, then line them up against recycle and crash events. Each cause leaves a different fingerprint: permissions give a steady Windows error 5 (access denied) on the same URLs; recycling gives bursts at recycle times with substatus 500.11 or 500.12; resource exhaustion gives 500.13 and rising response times before the errors; an application bug gives substatus 500.0 with Windows error 0 and an exception in the Application log or in a failed-request trace. I fix first whichever fingerprint accounts for the largest share of the 500s. If two tie, I take them in this order: permissions (smallest change, no restart), recycling settings, resource limits, application code (needs a developer).
Key terms
- Application pool and worker process: an application pool is a group of settings, and the worker process (
w3wp.exe) it starts, that serve the requests for one or more IIS applications. Learn describes the pool as the isolation boundary: a problem in one pool does not affect applications in another. - Recycling: IIS shutting a pool's worker process down and starting a fresh one, on a timer or when a limit such as memory or request count is hit, or after a configuration change.
- Substatus and Win32 status: the HTTP status is the three-digit code such as 500. The substatus is a second number that narrows it down (the 13 in 500.13). The Win32 status is the Windows error code behind the request: 0 means no Windows error, 5 means access denied.
- W3C log: IIS's text request log. A
#Fields:header line names the columns, then there is one line per request. - Rapid-fail protection: an IIS safety switch that removes every application in a pool from service when the worker process crashes too many times in a short window (5 crashes in 5 minutes by default).
- ApplicationPoolIdentity is the default virtual account a pool runs as, and
loadUserProfileis the pool setting that makes IIS load that account's Windows user profile (its personal folders and registry hive) for the worker process.
Order of work
Start with Step 1, because it only reads logs and costs nothing. Go to Step 2 when Step 1 points at recycling or exhaustion, or when the burst times need to be matched to server events. Use Failed Request Tracing (Step 3) for the application-bug and unclear cases, and the live appcmd and netsh commands in Step 2 only while an incident is happening. The custom-account checks come next, and are the first thing to test when Step 1 shows Windows error 5.
Step 1: group the 500s
IIS writes W3C log files under inetpub\logs\LogFiles\W3SVC<site id>. The #Fields: header names each column, so this function reads the header instead of assuming column positions and reports, per hour, how many requests ended in 500 and which substatus and Windows error code they carried.
function Get-Iis500Summary {
[CmdletBinding()]
param([Parameter(Mandatory)][string]$LogDirectory)
$total = @{}
$errors = [System.Collections.Generic.List[object]]::new()
foreach ($file in Get-ChildItem -Path $LogDirectory -Filter '*.log') {
$fields = $null
foreach ($line in [System.IO.File]::ReadLines($file.FullName)) {
if ($line.StartsWith('#Fields:')) { $fields = $line.Substring(8).Trim().Split(' '); continue }
if ($line.StartsWith('#') -or -not $fields) { continue }
$v = $line.Split(' ')
if ($v.Count -ne $fields.Count) { continue }
$f = @{}
for ($i = 0; $i -lt $fields.Count; $i++) { $f[$fields[$i]] = $v[$i] }
$hour = '{0} {1}:00' -f $f['date'], $f['time'].Substring(0, 2)
$total[$hour] = 1 + [int]$total[$hour]
if ($f['sc-status'] -eq '500') {
$errors.Add([pscustomobject]@{
Hour = $hour; SubStatus = $f['sc-substatus']; Win32 = $f['sc-win32-status']
Uri = $f['cs-uri-stem']; Ms = [int]$f['time-taken'] })
}
}
}
$errors | Group-Object -Property Hour, SubStatus, Win32 | ForEach-Object {
$first = $_.Group[0]
[pscustomobject]@{
Hour = $first.Hour
SubStatus = $first.SubStatus
Win32 = $first.Win32
Count = $_.Count
PctOfHour = [math]::Round(100 * $_.Count / $total[$first.Hour], 1)
TopUri = ($_.Group | Group-Object Uri | Sort-Object Count -Descending | Select-Object -First 1).Name
}
} | Sort-Object -Property Hour, SubStatus
}
Get-Iis500Summary -LogDirectory 'C:\inetpub\logs\LogFiles\W3SVC2' | Format-Table -AutoSize
A request line in the log, with the default columns, looks like this (illustrative values). The last four fields are sc-status, sc-substatus, sc-win32-status and time-taken in milliseconds:
#Fields: date time s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs(User-Agent) cs(Referer) sc-status sc-substatus sc-win32-status time-taken
2026-10-04 02:45:10 10.0.0.5 GET /reports/export - 443 - 10.0.1.20 Mozilla/5.0 - 500 0 5 12
2026-10-04 03:41:10 10.0.0.5 GET /api/price - 443 - 10.0.1.20 Mozilla/5.0 - 500 0 0 310
Running the function over a made-up log with 40 ordinary requests in each of two hours, six requests for /reports/export that ended 500 with Win32 status 5 in the first hour and three requests for /api/price that ended 500 with Win32 status 0 in the second, printed (real output of that run):
Hour SubStatus Win32 Count PctOfHour TopUri
---- --------- ----- ----- --------- ------
2026-10-04 02:00 0 5 6 13.000 /reports/export
2026-10-04 03:00 0 0 3 7.000 /api/price
Reading it: Count is how many requests fell in that hour with that substatus and Win32 pair, and PctOfHour is that count as a percentage of all requests logged in the same hour (6 of 46 is 13 percent, 3 of 43 is 7 percent). The first row is the permissions fingerprint (SubStatus 0 with Win32 5, one URL). The second is the application-bug fingerprint (SubStatus 0, Win32 0, one URL). Two different causes can coexist in one log, which is why the rows are grouped before anything is fixed.
How to read the rows. The substatus meanings below come from the IIS status-code reference.
| Row looks like | Fingerprint of | Meaning |
|---|---|---|
| Same URL every hour, SubStatus 0, Win32 5 | Permissions | Windows error 5 is access denied for the account running the pool |
| One hour with a burst, SubStatus 11 or 12 | Recycling | 500.11 is "application is shutting down", 500.12 is "application is busy restarting" |
| SubStatus 13, response times climbing first | Resource exhaustion | 500.13 is "web server is too busy" |
| SubStatus 0, Win32 0, spread across hours, one or two URLs | Application bug | The module returned an error that is not a Windows error code |
| Status 503 instead of 500 | Pool stopped | 503.0 means the pool is stopped or disabled; see rapid-fail protection below |
Step 2: line the errors up with what the server did
Recycles are logged by default on current IIS versions (the default logEventOnRecycle flags on IIS 10 and later cover Time, Requests, Schedule, Memory, IsapiUnhealthy, OnDemand, ConfigChange and PrivateMemory). Pull the System log entries for the pool around the burst hours:
$since = (Get-Date).AddDays(-2)
Get-WinEvent -FilterHashtable @{ LogName = 'System'; StartTime = $since } |
Where-Object { $_.Message -match 'application pool' -and $_.Message -match 'ContosoPool' } |
Sort-Object -Property TimeCreated |
Format-Table -Property TimeCreated, Id, Message -AutoSize -Wrap
Then look at the live process and what it is doing during an incident, from an elevated prompt:
%windir%\system32\inetsrv\appcmd.exe list wps /apppool.name:ContosoPool
%windir%\system32\inetsrv\appcmd.exe list requests /apppool.name:ContosoPool
%windir%\system32\inetsrv\appcmd.exe list apppool "ContosoPool" /text:*
netsh http show servicestate view=requestq
Output looks like this, in the formats Learn's AppCmd guide shows (illustrative values):
WP "3577" (apppool:ContosoPool)
REQUEST "fb0000008000000e" (url:GET /api/price,time:4276 msec,client:10.0.1.20)
- A worker-process ID that changes between two samples means the pool recycled or crashed between them.
list requestsshows currently executing requests with their elapsed time; several requests stuck for a long time point at exhaustion or a hung dependency.list apppool /text:*prints every setting, including the identity.- The request-queue view shows whether requests are waiting in HTTP.sys because the pool cannot take them.
Recycling checks against the defaults: the periodic restart interval is 29 hours, the request-count, virtual-memory and private-memory triggers are 0 (disabled), and rapid-fail protection stops a pool after 5 crashes within 5 minutes. A burst that repeats every 29 hours matches the default timer. Anything else (a memory trigger someone set, a configuration change, an on-demand recycle) shows in the event text.
Step 3: capture the failing request itself
For the application-bug and unclear cases, enable Failed Request Tracing: add the Tracing role service under Health and Diagnostics, enable it for the site, and add a rule for status code 500 (and a second rule with a timeTaken threshold to catch slow requests before they fail). IIS writes one XML file per failed request, with a freb.xsl style sheet, to %SystemDrive%\inetpub\logs\FailedReqLogFiles\W3SVC<site id>. The trace names the module that failed and the error details, which separates a permissions failure (access denied against a path) from an exception in application code.
What is special about a custom service account
By default a pool runs as ApplicationPoolIdentity, a virtual account written IIS AppPool\<pool name>, and content is secured to that name. A custom account changes three things you must check:
- NTFS rights. The account needs Read on the site folder and Modify only where the application writes. Grant exactly that, for example
icacls "D:\Sites\Contoso" /grant "CONTOSO\svc-web:(OI)(CI)RX"andicacls "D:\Sites\Contoso\App_Data" /grant "CONTOSO\svc-web:(OI)(CI)M". In that notation (OI) and (CI) mean the entry is inherited by files and by subfolders. - Network access. Outbound calls to a database or share run as that account (as the computer account for the built-in identities), so a file share or SQL login that was granted to the machine name will fail for the custom account.
- User profile. IIS does not load a Windows user profile by default, so code that writes to a profile or temp path can fail unless
loadUserProfileis set to true.
A password that expires or is changed, or a locked-out account, stops the worker processes from starting, which shows up as 503 rather than intermittent 500. Microsoft lists application pools among the supported uses of a group Managed Service Account (gMSA), whose password Active Directory rotates automatically; moving the pool to a gMSA removes that failure class.
Verify the fix without fooling yourself
An intermittent error can hide for hours by chance. Whether a clean hour means anything depends on the error rate. The chance that n requests contain no error at all is (1 - p) to the power n, where p is the error rate. It is close to e to the power minus (n x p), the expected error count n x p fed into an exponential decay, which is why the expected count tells you most of what you need:
| Error rate | Requests per hour | Expected 500s per hour | Chance of zero 500s by luck |
|---|---|---|---|
| 2.5 percent | 200 | 5 | 0.6 percent |
| 0.1 percent | 200 | 0.2 | 82 percent |
| 0.1 percent | 2000 | 2 | 14 percent |
The three rows, worked out: 0.975^200 = 0.0063, so 0.6 percent. 0.999^200 = 0.819, so 82 percent. 0.999^2000 = 0.135, which the table rounds to 14 percent. The 15-hour figure: 15 x 200 = 3,000 requests, 3,000 x 0.001 = 3 expected errors, and 0.999^3000 = 0.0497, about 5 percent.
At 2.5 percent one clean hour is convincing; at 0.1 percent and 200 requests an hour a clean hour proves nothing, and you need about 15 hours (3 expected errors, about a 5 percent chance of none) before the quiet means anything. Re-run the Step 1 summary over a window sized that way, and compare the count of 500s per hour, not just whether any appeared.
Trade-offs and pitfalls
- Raising memory or request recycling limits to "hide" 500.12 bursts trades visible errors for a longer-lived leak. Fix the leak or schedule the recycle at a quiet hour.
- Adding the service account to local Administrators makes access-denied errors vanish and widens what a compromised application can do. Grant the narrow right instead.
- Do not read a stopped pool as an intermittent 500: rapid-fail protection removes every application in the pool from service, and the client sees 503.
Two offices share a department's files over a slow WAN link. Design a single-path file access experience using Windows features, including how users are directed to the nearest copy, how data is kept in sync without saturating the link, and how you seed the initial large dataset.
Sample Answer
Direct answer
Use two Windows Server file-services features together: DFS Namespaces (DFS-N) gives users one path that never changes, and DFS Replication (DFS-R) keeps one copy of the data in each office. DFS-N is a directory of share locations stored in Active Directory: it hands each client a referral, an ordered list of servers, with the server in the client's own AD site first. DFS-R copies changes between the servers, sending only the changed blocks of a file (remote differential compression, RDC) on a schedule that caps the bandwidth. Seed the large first copy by copying the data (or using DFS-R database cloning) before replication starts, because pushing it over the WAN would take weeks.
flowchart LR
U1[Office A user] -->|\\corp.example.com\Dept| NS[(Domain-based namespace)]
U2[Office B user] -->|\\corp.example.com\Dept| NS
NS -->|referral: own site first| FA[fs-a share Dept]
NS -->|referral: own site first| FB[fs-b share Dept]
FA <-->|DFS Replication, RDC, throttled schedule| FB
Part 1: one path, nearest copy
Create a domain-based namespace, meaning its configuration lives in Active Directory and several servers can host it, so it survives the loss of one office. Add a folder with one target per office:
New-DfsnRoot -Path '\\corp.example.com\Dept' -TargetPath '\\fs-a\DeptRoot' -Type DomainV2 `
-EnableSiteCosting $true
New-DfsnFolder -Path '\\corp.example.com\Dept\Files' -TargetPath '\\fs-a\Dept' -EnableTargetFailback $true
Only the fs-a target exists at this point, on purpose. The order of operations matters: if the fs-b target were published now, office B users would be referred to a server with no data yet. The sequence is: namespace with the fs-a target (this part), replication group with fs-a only (Part 2), seed fs-b and join it (Part 3), and only then add the fs-b folder target (the last step of Part 3).
How users reach the nearest copy once both targets exist:
- DFS-N orders the referral by AD site (an Active Directory object that represents a well-connected set of IP subnets, usually one office): the client's own site first, then other targets. This only works if both offices exist in Active Directory Sites and Services with their IP subnets defined, because the client's site is derived from its subnet.
EnableSiteCostingmakes the fallback order follow the site link costs instead of random order, so a failure at one office sends users to the other over the cheaper path.EnableTargetFailbackreturns clients to their local server when it comes back. Clients cache a root referral for 300 seconds by default and a folder referral for 1800 seconds.- Users always type
\\corp.example.com\Dept\Files, so moving a server only changes a target.
For a folder where two offices often edit the same file, do not give both targets equal rank. DFS-R is multi-master (every member accepts writes and replicates them to the others), so two simultaneous edits of one file end with one version winning. A referral priority class overrides the site ordering: GlobalHigh puts a target first for every client and GlobalLow puts it last. Making fs-a GlobalHigh sends everyone to the primary office and keeps fs-b as a standby. Run these after the fs-b target exists (Part 3, step 5):
Set-DfsnFolderTarget -Path '\\corp.example.com\Dept\Files' -TargetPath '\\fs-a\Dept' -ReferralPriorityClass GlobalHigh
Set-DfsnFolderTarget -Path '\\corp.example.com\Dept\Files' -TargetPath '\\fs-b\Dept' -ReferralPriorityClass GlobalLow
Part 2: keep the data in sync without saturating the link
DFS-R is configured as a replication group with one replicated folder. Build it in two stages: first the group with only fs-a, the server that already holds the data and is the primary member (the one whose files DFS-R treats as authoritative the first time it compares the two sides, so a stale copy on the other server cannot overwrite the real data); fs-b joins after it has been seeded (Part 3).
New-DfsReplicationGroup 'RG-Dept' |
New-DfsReplicatedFolder -FolderName 'Dept' |
Add-DfsrMember -ComputerName 'fs-a'
Set-DfsrMembership -GroupName 'RG-Dept' -FolderName 'Dept' -ComputerName 'fs-a' -ContentPath 'D:\Data\Dept' -PrimaryMember $true
Update-DfsrConfigurationFromAD
Set-DfsrMembership always needs the group, the replicated folder and the member computer named together (-GroupName, -FolderName, -ComputerName), because a replicated folder only has a content path and a primary flag once it is tied to one member of one group; later calls shown here that pass a freshly added member down the pipeline get the group and computer names from that member.
Replication is bandwidth-aware in two ways. RDC sends only the changed parts of a file that already exists on the other side. The group schedule caps the rate per 15-minute block. Assume a 10 Mbps WAN: hold replication to 2 Mbps (20 percent of the link) from 08:00 to 18:00, when users share the link, and 8 Mbps (80 percent) the rest of the day. The schedule string has 96 hexadecimal characters (24 hours times 4 blocks of 15 minutes); each character is one 15-minute block and holds a bandwidth code from 0 to F. Microsoft's table for the cmdlet reads: 0 no replication, 1 = 16 Kbps, 2 = 64 Kbps, 3 = 128 Kbps, 4 = 256 Kbps, 5 = 512 Kbps, 6 = 1 Mbps, 7 = 2 Mbps, 8 = 4 Mbps, 9 = 8 Mbps, A = 16 Mbps, B = 32 Mbps, C = 64 Mbps, D = 128 Mbps, E = 256 Mbps, F = full bandwidth. So 7 means 2 Mbps and 9 means 8 Mbps:
$hours = 0..23 | ForEach-Object { if ($_ -ge 8 -and $_ -lt 18) { '7' } else { '9' } }
$bandwidth = -join ($hours | ForEach-Object { $_ * 4 })
Set-DfsrGroupSchedule -GroupName 'RG-Dept' `
-Day Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday `
-BandwidthDetail $bandwidth
In PowerShell, multiplying a string by a number repeats it: '7' * 4 is 7777. The script therefore turns each hour into four identical blocks, and joining 24 hours gives 96 characters. The string is 32 nines (hours 0 to 7, 8 hours x 4 blocks), 40 sevens (hours 8 to 17, 10 hours x 4 blocks), then 24 nines (hours 18 to 23, 6 hours x 4 blocks); 32 + 40 + 24 = 96. Once fs-b has joined (Part 3), watch replication health with the backlog, the list of changes the destination has not received yet; the verbose switch prints the count of backlogged files (0 means fs-b has received everything fs-a has sent so far):
Get-DfsrBacklog -GroupName 'RG-Dept' -FolderName 'Dept' `
-SourceComputerName 'fs-a' -DestinationComputerName 'fs-b' -Verbose
A backlog is latency, not necessarily a fault; alert when it keeps growing across a full day. Two folders on each member need a size limit. The staging folder holds a compressed copy of a file while it is being sent; the ConflictAndDeleted folder keeps files that lost a conflict or were deleted, so they can be restored. Each defaults to 4096 MB. When a folder reaches 90 percent of its quota, DFS-R deletes the oldest files until it falls to 60 percent, so a quota smaller than the largest files forces constant cleanup and re-staging. A larger staging quota keeps staged data longer and improves replication performance. For example, with a 16384 MB staging quota (an illustrative size) cleanup starts at 16384 x 0.9 = 14,745.6 MB and stops at 16384 x 0.6 = 9,830.4 MB:
Set-DfsrMembership -GroupName 'RG-Dept' -FolderName 'Dept' -ComputerName 'fs-a' `
-StagingPathQuotaInMB 16384 -ConflictAndDeletedQuotaInMB 4096 -Force
Repeat the command for fs-b after it joins in Part 3.
Part 3: seed the initial dataset
Take a 2 TB dataset as the example. The capped schedule moves 10 hours at 2 Mbps plus 14 hours at 8 Mbps per day, which is (10 hours x 2 Mbps + 14 hours x 8 Mbps) = 132 Mbps-hours. Multiply by 3,600 seconds per hour to get megabits: 132 x 3600 = 475,200 Mbit. Divide by 8 bits per byte: 59,400 MB, or 59.4 GB (decimal) per day. 2,000 GB divided by 59.4 GB per day is about 33.7 days, even with the link fully used by replication. Seeding removes that.
- Start from the group built in Part 2, in which only
fs-ais a member, so nothing replicates yet. - Copy the data to
fs-bpreserving permissions, owners and timestamps: the Basic validation level compares size, modified time and a hash of the ACL, so a copy that loses permissions is treated as different and sent again. Use a LAN copy before the server moves, or an external disk shipped to the office:
robocopy D:\Data\Dept \\fs-b\D$\Data\Dept /E /B /COPYALL /R:6 /W:5 /MT:64 /XD DfsrPrivate /TEE /LOG+:preseed.log
When it finishes, robocopy prints a summary table with the rows Dirs, Files and Bytes and the columns Total, Copied, Skipped, Mismatch, FAILED and Extras. Read the FAILED column first: it must be 0 for every row before you go on, and a non-zero count means files (often locked or too-long paths) did not reach fs-b. /B copies in backup mode to read files regardless of their ACLs, /COPYALL keeps data, attributes, timestamps, ACLs, owner and auditing information, /XD DfsrPrivate skips DFS-R's own folder, /MT:64 uses 64 threads (valid range 1 to 128), and /R:6 /W:5 limits retries because robocopy's default is a million retries 30 seconds apart.
3. For a very large dataset, use DFS-R database cloning so fs-b does not have to hash every file again. On fs-a, export the database for the volume (replication on that volume stops while it runs, and the path must be on a local volume), copy the clone files, then import on fs-b:
Export-DfsrClone -Volume 'D:' -Path 'D:\DfsRClone' -Validation Basic
Get-DfsrCloneState
# copy D:\DfsRClone to fs-b, remove D:\System Volume Information\dfsr there if present, then on fs-b:
Import-DfsrClone -Volume 'D:' -Path 'D:\DfsRClone'
Get-DfsrCloneState
Export-DfsrClone does not return until the export finishes, so run Get-DfsrCloneState from a second console. It prints one word: Started DB Export while prerequisites are validated, Processing DB Export while the database is written, and Ready before cloning starts and after it completes. The import side shows Started DB Import and Processing DB Import the same way. Wait for Ready on each server before moving on.
Validation levels trade speed for assurance: None assumes the copy is perfect, Basic compares size, modified time and a hash of the ACL for each file and replicates only differences, Full computes the DFS-R hash for every file. A mismatched file is moved aside to the PreExisting or ConflictAndDeleted folder and replicated again, not silently kept.
4. Add fs-b to the group with the same content path and connect it to fs-a, then refresh the configuration on both servers so each reads the new membership from Active Directory. The first replication cycle then moves only the differences (what changed during the copy), not 2 TB:
Add-DfsrMember -GroupName 'RG-Dept' -ComputerName 'fs-b' |
Set-DfsrMembership -FolderName 'Dept' -ContentPath 'D:\Data\Dept'
Add-DfsrConnection -GroupName 'RG-Dept' -SourceComputerName 'fs-a' -DestinationComputerName 'fs-b'
Update-DfsrConfigurationFromAD
- When the backlog from Part 2 reaches 0, publish the second copy to users by adding the
fs-bfolder target to the namespace. Users in office B are now referred tofs-bfirst because it sits in their AD site:
New-DfsnFolderTarget -Path '\\corp.example.com\Dept\Files' -TargetPath '\\fs-b\Dept'
Trade-offs and pitfalls
- DFS-R is replication, not backup: a deletion replicates to the other office within minutes. Keep backups at one site and test restores.
- DFS-N and DFS-R are separate features. The namespace chooses where users read and write; replication only moves the data. A namespace with two active targets and replication that is behind will show users different content in each office; the backlog count is the number to watch.
- Domain-based namespace servers must be members or domain controllers in the domain and, unlike a stand-alone namespace, the namespace cannot be a clustered resource.
- The dataset alternative is Azure File Sync, which keeps a full copy in Azure and a cache on each Windows file server; choose it when cloud storage and backup are already part of the plan.
- Do not restore a replicating server from a virtual machine snapshot or saved state: DFS-R fails afterwards and needs special database recovery.
You are handed a freshly installed Windows Server 2022 machine and asked to make it production ready. Walk me through your build runbook from first boot to handover, including how it gets patched, how it is managed remotely, what you install, and the checklist you use to prove it is ready.
Sample Answer
Direct answer
Build it in a fixed order: choose the installation option, name it and join it to the domain in the right organizational unit (OU, an Active Directory container that Group Policy attaches to), prove remote management works, bring it fully up to date with the patching tool you will keep using, install only the roles the workload needs, confirm the security baseline applied, then run a written readiness check and hand over with the evidence. Patching is the step people forget. Microsoft's documentation says Windows Update does not download and install updates automatically by default on Windows Server 2016 and later, so a new server stays unpatched until someone configures that.
The eight steps
- Installation option. Pick Server Core (the option without a graphical desktop) unless the application's installer needs a desktop. Core is managed with PowerShell and Windows Admin Center (WAC, a browser-based management tool for Windows Server that Microsoft ships at no extra cost). One consequence: the Microsoft Defender Antivirus user interface needs the Desktop Experience option and is not available on Core, so you check Defender from PowerShell.
- Identity. Choose the host name (it is applied in the next step together with the domain join, so the machine restarts once), and set a fixed address (or a DHCP reservation), the domain's DNS servers as the resolvers, and the time zone. The domain join in the next step finds a domain controller through DNS, so wrong resolvers fail there.
- Join the domain into the right OU. Rename and join in one operation so the machine restarts once:
Rename-Computer -NewName 'app-fs-01' -Force
Add-Computer -DomainName 'corp.example.com' `
-OUPath 'OU=Servers,OU=Prod,DC=corp,DC=example,DC=com' `
-Server 'dc-1.corp.example.com' `
-Credential (Get-Credential) `
-Options JoinWithNewName, AccountCreate `
-Restart
Reading the command: the backtick at the end of a line tells PowerShell the command continues on the next line; Get-Credential opens a prompt for the domain account that is allowed to join computers; -Options JoinWithNewName, AccountCreate tells the join to use the new name set by Rename-Computer (a rename does not take effect until a restart) and to create the computer account; -Restart reboots once at the end. -OUPath puts the computer account straight into the OU that carries the server baseline Group Policy Objects (GPOs, bundles of settings the domain pushes to machines), so the baseline applies from the first start instead of after someone moves the account. -Server must be the domain controller's fully qualified domain name (FQDN, such as dc-1.corp.example.com): Microsoft documents that domain-join hardening from August 2024 requires the FQDN, so a short name such as dc-1 is the wrong form to type.
4. Remote management. PowerShell remoting is enabled by default on Windows Server 2012 and later, so you do not run Enable-PSRemoting on a new build. You run it only if your baseline disabled remoting. On server editions its firewall rules cover the domain and private profiles, and the public profile only from the same subnet. Prove it from the jump host (a separate administration machine you run remote commands from), not from the server itself:
Invoke-Command -ComputerName 'app-fs-01.corp.example.com' -ScriptBlock { $env:COMPUTERNAME }
Then add the server to Windows Admin Center, and make one Active Directory group the server administrators instead of listing individual accounts.
5. Patching. Decide the tool first (next section), then run one complete round before handover: install everything offered, restart, rescan, repeat until nothing is pending. Run it again after step 6, because adding roles can offer more updates.
6. Roles and features. Install only what the workload needs, and preview first. Install-WindowsFeature does not install management tools unless you pass -IncludeManagementTools:
Install-WindowsFeature -Name Web-Server -IncludeManagementTools -WhatIf
Install-WindowsFeature -Name Web-Server -IncludeManagementTools
The first line previews and the second installs Internet Information Services (IIS, the web server role, feature name Web-Server) as an example. Record the final list of installed features in the build ticket: it becomes the expected list in the readiness check. The ticket is just a text list of feature names. To capture it, run (Get-WindowsFeature | Where-Object Installed).Name | Set-Content features.txt; an excerpt of that file looks like this (illustrative and abbreviated: lines are omitted and a real server lists more, so always generate the file from the server rather than typing it):
FileAndStorage-Services
Web-Server
Web-WebServer
Web-Common-Http
Web-Default-Doc
Web-Mgmt-Tools
Web-Mgmt-Console
- Security baseline, kept brief. The domain's server baseline GPO does the hardening (a Center for Internet Security (CIS) benchmark or your own standard, which is a separate subject). What the build verifies is that Windows Firewall is on for all three profiles and that Defender Antivirus is running. The same block also checks the time source:
Set-NetFirewallProfile -Name Domain, Public, Private -Enabled True
Get-Service -Name WinDefend
w32tm /query /source
Line by line: the first turns Windows Firewall on for each of its three network profiles (Domain, Private, Public); the second shows whether the Defender Antivirus service (WinDefend) is running; the third prints which time source the Windows Time service is following. Time matters on a domain member because Kerberos sign-in fails when the clock drifts too far from the domain controller's, and a domain member normally follows a domain controller. Defender Antivirus: Microsoft documents it as installed and enabled by default on Windows Server 2016 and later. If a non-Microsoft antivirus product is installed, Defender normally goes passive, and that is expected.
8. Prove it and hand over. Run the readiness script below, the jump-host test from step 4, and two checks no script can do: restore one file from the new backup job, and fire a test alert from the monitoring agent.
Patching: pick one and say why
| Option | Status according to Microsoft documentation | Choose it when |
|---|---|---|
| Azure Update Manager (a patching service in Azure that reaches on-premises servers through Azure Arc, an agent that registers them with Azure) | Schedules updates in maintenance windows, runs periodic update assessments every 24 hours when enabled, and can also apply updates published to Windows Server Update Services (WSUS) | You already have an Azure subscription and may install the Arc agent on servers |
| WSUS | Deprecated and no longer adding new features, but still supported for production and still receiving security and quality updates | An existing WSUS estate, or servers that cannot reach Azure |
| Windows Update directly, set to install automatically by Group Policy (Configure Automatic Updates, option 4) | Installs updates, including Defender security intelligence, with no staging or compliance report | A handful of servers where reporting does not matter |
My pick for a new build is Azure Update Manager through Arc, because WSUS gets no new features and Update Manager gives both a schedule and a compliance view in one place. What flips it: no Azure subscription, a rule against agents that call out, or an existing WSUS estate you are not migrating this year (then point the server at WSUS by Group Policy, and plan the exit). Check the Azure pricing page for the per-server cost of Update Manager on Arc-enabled servers, for your server count, before committing. If you do use WSUS, approve the Defender security intelligence updates for these servers, because Defender gets them through the same path.
Readiness check
Six checks run on the server and one from the jump host. Every row has a command and a pass condition:
| # | Check | Command | Pass condition |
|---|---|---|---|
| 1 | Domain member server | Get-CimInstance -ClassName Win32_ComputerSystem | PartOfDomain is True and DomainRole is 3. DomainRole is a number for the machine's role: 0 standalone workstation, 1 member workstation, 2 standalone server, 3 member server, 4 or 5 domain controller. A server that was never joined reports 2, so 3 proves the join worked |
| 2 | Firewall | Get-NetFirewallProfile -All | Enabled is True on Domain, Private and Public |
| 3 | Defender | Get-Service -Name WinDefend | Status is Running |
| 4 | Time | w32tm /query /source | Names an upstream source, not the server itself. Domain members sync through the domain hierarchy by default |
| 5 | Patch evidence | Get-HotFix | Newest InstalledOn is within 35 days |
| 6 | Feature list | Get-WindowsFeature filtered to Installed | Exactly the list in the build ticket |
| 7 | Remote management | Invoke-Command from the jump host (step 4) | Returns the server's name |
param(
[Parameter(Mandatory)][string[]]$ExpectedFeatures,
[int]$MaxPatchAgeDays = 35
)
$ErrorActionPreference = 'Stop'
function New-Result($Check, $Pass, $Detail) {
[pscustomobject]@{ Check = $Check; Pass = [bool]$Pass; Detail = $Detail }
}
$results = @()
# 1. Member server of a domain (DomainRole 3 = Member Server).
$cs = Get-CimInstance -ClassName Win32_ComputerSystem
$results += New-Result 'Domain member server' `
($cs.PartOfDomain -and $cs.DomainRole -eq 3) "Domain=$($cs.Domain) Role=$($cs.DomainRole)"
# 2. All three firewall profiles on.
$off = @(Get-NetFirewallProfile -All | Where-Object { $_.Enabled.ToString() -ne 'True' })
$results += New-Result 'Firewall profiles enabled' ($off.Count -eq 0) "Off: $(($off.Name) -join ',')"
# 3. Defender Antivirus service running.
$svc = Get-Service -Name WinDefend
$results += New-Result 'Defender service running' ($svc.Status -eq 'Running') "Status=$($svc.Status)"
# 4. Time source is not the server itself.
$src = (w32tm /query /source | Out-String).Trim()
$results += New-Result 'Time source is upstream' ($src -and $src -ne $env:COMPUTERNAME) "Source=$src"
# 5. Newest hotfix is recent (supporting evidence only, see notes).
$newest = Get-HotFix | Sort-Object -Property InstalledOn | Select-Object -Last 1
$age = if ($newest) { [int]((Get-Date) - $newest.InstalledOn).TotalDays } else { [int]::MaxValue }
$results += New-Result 'Recent hotfix present' ($age -le $MaxPatchAgeDays) "Newest=$($newest.HotFixID) AgeDays=$age"
# 6. Installed roles and features match the build ticket exactly.
$installed = @(Get-WindowsFeature | Where-Object Installed | Select-Object -ExpandProperty Name)
$extra = @($installed | Where-Object { $_ -notin $ExpectedFeatures })
$missing = @($ExpectedFeatures | Where-Object { $_ -notin $installed })
$results += New-Result 'Features match build ticket' ($extra.Count -eq 0 -and $missing.Count -eq 0) `
"Extra=$($extra -join ',') Missing=$($missing -join ',')"
$results | Format-Table -AutoSize
if ($results | Where-Object { -not $_.Pass }) { exit 1 }
exit 0
Run it as .\server-readiness.ps1 -ExpectedFeatures (Get-Content features.txt) with the list from your ticket. It prints one line per check and exits 1 if any row fails, so a build pipeline can stop on it. Example output for a server that fails two checks (illustrative values, rendered by the script's own Format-Table step):
Check Pass Detail
----- ---- ------
Domain member server True Domain=corp.example.com Role=3
Firewall profiles enabled True Off:
Defender service running True Status=Running
Time source is upstream True Source=dc-1.corp.example.com
Recent hotfix present False Newest=KB5000001 AgeDays=61
Features match build ticket False Extra=Telnet-Client Missing=
What a failing row tells you to do next: Recent hotfix present False means run another patch round with the chosen tool and check its compliance report; Features match build ticket False names the Extra features to remove or the Missing ones to install, or to add to the ticket if they are intended; a False domain row means the server is not a domain member server (the join never ran or did not finish, or the machine is a domain controller), so go back to step 3; a False firewall or Defender row usually means the baseline Group Policy has not applied, so check which OU the computer account is in. On Time source is upstream, the script rejects only an empty result or the server's own name, so also read the printed source yourself: on a domain member it should be a domain controller.
The 35 days in row 5 is a starting point: the gap between two consecutive Patch Tuesdays (the second Tuesday of each month) is 28 to 35 days across 2026 and 2027, computed, so 35 is the longest gap. A check run on 2026-11-20 therefore wants a hotfix dated 2026-10-16 or later. Widen it if your maintenance window lags the release by days.
Pitfalls
- Row 5 is only supporting evidence.
Get-HotFixreads theWin32_QuickFixEngineeringclass, which per Microsoft returns only updates supplied by Component Based Servicing (the Windows component that installs most Windows updates). Updates installed through other mechanisms are not listed, so an empty result does not prove an unpatched server and a recent result does not prove a compliant one. The authority is the patching tool's own compliance report. - Joining into the default Computers container leaves the baseline GPOs unapplied. Naming
-OUPathprevents it. - Remoting tested only locally proves nothing about the firewall or name resolution the administrators will actually use. Test from the jump host.
- Defender passive mode after a third-party product is installed is normal. Defender disabled with nothing else installed is a finding.
Unlock Full Question Bank
Get access to all 34 Windows Server Administration interview questions and detailed answers.
Sign in to ContinueJoin thousands of developers preparing for their dream job.