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.
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.
You must move the shares from several standalone file servers onto a new highly available clustered file service with encryption on. How do you copy the data so permissions and ownership survive, how do you cut over with minimal user disruption, and how do you prove the result is correct and resilient?
Sample Answer
Direct answer
Move the data with Storage Migration Service (SMS), the Windows Server tool that inventories the old servers, copies files together with share settings and security, and can hand each old server's name and address to the new one at cutover. Target a clustered File Server for general use role (not a Scale-Out File Server), turn on SMB encryption on the shares, seed the data while the old servers stay live, run a short final transfer inside the cutover window, then prove correctness by comparing stored security descriptors and prove resilience by moving the role between nodes and failing a node on purpose. Robocopy is the fallback when SMS cannot do the job, for example NTFS to ReFS.
Choose the target before copying anything
Two kinds of clustered file server exist, and Microsoft's comparison table decides which one fits user shares:
| File Server for general use | Scale-Out File Server (SOFS) | |
|---|---|---|
| Shares online on | One node at a time (active-passive) | All nodes at once (active-active) |
| Intended for | Information worker files, home folders | Application data such as Hyper-V and SQL Server over SMB |
| Folder Redirection, home directories, roaming profiles | Yes | Not recommended |
| DFS Replication, File Server Resource Manager | Yes | No |
So: File Server for general use on top of a failover cluster. If the cluster uses Storage Spaces Direct (software-defined storage that pools the local disks of the nodes into shared volumes), the shares still live on a general-use role, not on a scale-out share. Build the role in Failover Cluster Manager with its own client access point (the network name and IP address that clients type to reach the clustered file server, which moves with the role from node to node) before migrating.
File system choice has one trap. Microsoft's comparison table recommends the Resilient File System (ReFS) with Storage Spaces Direct, but SMS supports NTFS (the New Technology File System) to NTFS and ReFS to ReFS only, never NTFS to ReFS. If the old shares are NTFS and you want SMS cutover, create NTFS volumes for these shares. If you insist on ReFS, plan the copy with robocopy.
"Encryption on" means two separate things:
- In transit: Server Message Block (SMB) encryption, enabled per share with
Set-SmbShare -Name Finance -EncryptData $true, or for the whole server withSet-SmbServerConfiguration -EncryptData $true. It requires SMB 3.0 or later on both sides. SMB 3.1.1 negotiates the AES-128-GCM cipher (a modern authenticated encryption mode) by default, and AES-256 suites exist from Windows Server 2022. A client that only speaks SMB 2.x or 1.0 gets Access denied and the server logs event ID 1003 inMicrosoft-Windows-SmbServer/Operational, so inventory old clients first. SMS carries each share's Encrypt Data flag across, but verify it on the new shares. - At rest: SMB encryption does not cover it; Microsoft's SMB documentation points to BitLocker for data at rest. Decide that separately for the new volumes.
Copy so permissions and ownership survive
With SMS (three stages: inventory, transfer, cutover): the transfer moves files, shares and security configuration. It migrates every share flag and its security descriptor (the access control list, ACL, and related data), including access-based enumeration (users see only the files and folders they have permission to open), continuous availability (a clustered-share setting that lets open file handles survive a node failover, at the cost of writing through to disk) and encryption. A cluster can be the destination: SMS migrates a standalone source into a file server resource on the cluster (it migrates the file server resource, not the cluster itself). Behaviours to plan around:
- The destination must hold no production data. The first transfer backs up what is there; later transfers mirror the source, overwriting and deleting anything not on the source.
- Files that applications hold exclusively locked are retried (three tries, sixty seconds apart by default) and skipped files are picked up by re-running the transfer.
- Previous Versions (shadow copies) are not migrated, domain controllers are not supported as sources for cutover, and consolidating several servers onto one server with colliding names is not supported. The supported way to consolidate is one file server resource per source on the cluster.
With robocopy, the flags that keep security (all verified against the command reference):
robocopy \\old-fs1\Finance E:\Shares\Finance /E /COPYALL /DCOPY:DAT /ZB /R:2 /W:5 /MT:16 /NP /LOG+:C:\Logs\finance-seed.log
robocopy \\old-fs1\Finance E:\Shares\Finance /MIR /COPYALL /DCOPY:DAT /SECFIX /ZB /R:2 /W:5 /MT:16 /NP /LOG+:C:\Logs\finance-final.log
Reading the two commands in plain words: the first is the seed copy. It copies the whole tree including empty folders (/E) with data, attributes, timestamps, ACLs, owner and audit settings (/COPYALL), keeps folder timestamps (/DCOPY:DAT), retries a locked file twice, five seconds apart (/R:2 /W:5), uses 16 copy threads (/MT:16), hides per-file percentages (/NP) and appends to a log (/LOG+). It never deletes anything on the destination. The second is the final pass inside the cutover window. /MIR makes the destination an exact mirror, so it also removes files that no longer exist on the source, and /SECFIX re-applies security to files that were skipped as unchanged. Run the seed command first, repeat it while users work, and run the mirror command only once users are stopped.
/COPYALL equals /COPY:DATSOU (data, attributes, timestamps, ACLs, owner, auditing). /DCOPY:DAT adds directory timestamps to the default directory copy. /ZB is restartable mode that falls back to backup mode when access is denied. /MT:16 uses 16 threads (default 8, range 1 to 128). /MIR is /E plus /PURGE, so it deletes destination files missing from the source; point it the right way round. /SECFIX repairs security on files that were skipped as unchanged. Exit codes of 8 or higher mean at least one failure, so a wrapper script must test for that, not for non-zero.
Choosing between the tools. Each row is a different job, so the right one depends on whether you are moving a server's shares, copying files, keeping servers in sync or protecting storage:
| Tool | Best for | Limits |
|---|---|---|
| SMS | Guided server replacement with share settings and name/IP takeover | No NTFS to ReFS, no shadow copy history, no many-to-one consolidation |
| robocopy | Scripted one-way copy, NTFS to ReFS, odd layouts | No share creation, no identity takeover, destructive /MIR |
| Distributed File System (DFS) Replication | Keeping two or more servers in sync over time | Multi-writer by design; for user shares make sure users reach only one server at a time to avoid conflicting edits |
| Storage Replica | Replicating data between servers or clusters for disaster recovery (Microsoft's description) | Protects a copy of storage you already run; it does not create shares or move a server's name and address, so use it after the migration for resilience |
Cut over with minimal disruption
Worked timing, with stated assumptions: 6 TB in total, a 1 Gbit/s path that sustains 70% of line rate, and 2% of the data changing per day.
Step by step:
- Effective rate: 1 Gbit/s x 70% = 0.70 x 10^9 = 700,000,000 bits per second.
- Data in bits: 6 TB = 6 x 10^12 bytes, and each byte is 8 bits, so 6 x 10^12 x 8 = 48 x 10^12 = 4.8 x 10^13 bits.
- Seed time: 4.8 x 10^13 / 7 x 10^8 = 68,571 seconds, which is 68,571 / 3,600 = 19.05 hours.
- Daily change: 2% of 6,000 GB = 120 GB = 1.2 x 10^11 bytes = 9.6 x 10^11 bits.
- Time for one nightly pass: 9.6 x 10^11 / 7 x 10^8 = 1,371 seconds = 22.9 minutes.
So: run the seed over a weekend while users keep working (19 hours, with spare), repeat the transfer nightly (each pass moves about 23 minutes of changes), and make the cutover window about 45 minutes as a floor: final transfer (23 minutes), cutover and checks. SMS restarts the servers several times during cutover and waits on Active Directory and DNS replication, so rehearse the cutover and extend the window if the restarts take longer than the remaining 22 minutes.
- Lower risk first: re-run transfers until a pass is short, and fix the skipped-file list.
- In the window, stop users (set the old shares read-only or disconnect sessions), run the final transfer, run the checks below.
- Cut over. In SMS the destination takes the source server's name and IP address, and the old server is renamed and given a new IP address so users and applications can no longer reach it, while its contents are left untouched, so rollback is possible. SMS does not update certificates that name the old server, so reissue them.
- If users reach data through a Distributed File System (DFS) namespace path, move them with namespace targets instead of renaming servers. A DFS namespace is a single virtual folder path such as
\\corp.contoso.com\dfs\Finance; each folder in it points to one or more namespace targets (the real shares). When a client opens the path, a namespace server hands back a referral, an ordered list of targets to try. Add the new target and take the old one offline; clients cache referrals, so shorten the referral cache time beforehand:
New-DfsnFolderTarget -Path '\\corp.contoso.com\dfs\Finance' -TargetPath '\\fs-finance\Finance'
Set-DfsnFolderTarget -Path '\\corp.contoso.com\dfs\Finance' -TargetPath '\\old-fs1\Finance' -State Offline
Clients receive no referrals for an offline folder target. For availability, Microsoft's guidance is to put a stand-alone namespace on a failover cluster, or to host a domain-based namespace on multiple namespace servers, so decide where the namespace lives before cutover and do not assume it moves with the file cluster role.
Prove it is correct
- Data: a list-only robocopy pass (
/L /E) after the final transfer should report nothing to copy. - Security: build a map of path to SDDL (Security Descriptor Definition Language, the text form of an ACL) on each side and compare. To read an SDDL string such as
O:BAG:DUD:PAI(A;OICI;0x1301bf;;;DU):O:BAis the owner (Builtin Administrators),G:DUis the primary group (Domain Users),D:starts the DACL (the list of allow and deny entries),Pmeans inheritance from the parent is blocked andAImeans the list was set up by automatic inheritance. Each parenthesised entry readstype;flags;rights;;;who:Ais Allow,OICImeans object inherit plus container inherit (it applies to files and subfolders), the rights are a number, andDUis the trustee, Domain Users. In an entry,IDin the flags field marks an entry inherited from a parent folder,FAis full control andSYis the Local System account. For the rights number,0x1301bfis the NTFS Modify permission (read, write, execute and delete) and0x1200a9is Read and execute, so the\Finance\Managersmismatch below means Domain Users has Modify on the source and only Read on the target. The function below is the comparison; the sample data shows each kind of mismatch it reports. I ran it under PowerShell 7; theGet-Aclcalls that fill the maps need Windows and were not run.
function Compare-SddlMap {
param(
[Parameter(Mandatory)][hashtable]$Source,
[Parameter(Mandatory)][hashtable]$Target
)
foreach ($path in $Source.Keys | Sort-Object) {
if (-not $Target.ContainsKey($path)) {
[pscustomobject]@{ Path = $path; Problem = 'missing on target' }
} elseif ($Source[$path] -ne $Target[$path]) {
[pscustomobject]@{ Path = $path; Problem = 'ACL differs' }
}
}
foreach ($path in $Target.Keys | Sort-Object) {
if (-not $Source.ContainsKey($path)) {
[pscustomobject]@{ Path = $path; Problem = 'extra on target' }
}
}
}
# In production each map is built with:
# Get-ChildItem -Recurse | ForEach-Object { $map[$_.FullName.Substring($root.Length)] = (Get-Acl -LiteralPath $_.FullName).Sddl }
$source = @{
'\Finance' = 'O:BAG:DUD:PAI(A;;FA;;;SY)'
'\Finance\Managers' = 'O:BAG:DUD:PAI(A;OICI;0x1301bf;;;DU)'
'\Finance\Working\a.xlsx' = 'O:BAG:DUD:AI(A;ID;0x1301bf;;;DU)'
}
$target = @{
'\Finance' = 'O:BAG:DUD:PAI(A;;FA;;;SY)'
'\Finance\Managers' = 'O:BAG:DUD:PAI(A;OICI;0x1200a9;;;DU)'
'\Finance\Working\b.xlsx' = 'O:BAG:DUD:AI(A;ID;0x1301bf;;;DU)'
}
Compare-SddlMap -Source $source -Target $target | Format-Table -AutoSize | Out-String -Width 120
Path Problem
---- -------
\Finance\Managers ACL differs
\Finance\Working\a.xlsx missing on target
\Finance\Working\b.xlsx extra on target
- Shares: compare
Get-SmbShare | Select-Object Name, EncryptData, FolderEnumerationMode, ContinuouslyAvailablebetween the old and new server.EncryptDatais the per-share SMB encryption flag andFolderEnumerationModeshows whether access-based enumeration is on (AccessBased) or off (Unrestricted). - People: sign in as a member of each access group and confirm open, write and denied cases on a sample folder.
Prove it is resilient
- Run
Test-Cluster -Node 'node-a','node-b'and read the report before moving data. Check quorum: with one static vote per node and no witness, two nodes have 2 votes and need 2 for a majority, so losing either node loses quorum. Adding a witness (a small disk or file share that casts a tie-breaking vote, so the cluster never splits evenly) gives 3 votes and a majority of 2, so one node can fail. - Planned failover:
Move-ClusterGroup -Name 'FS-FINANCE' -Node 'node-b', then back tonode-a, while a client copies a large file. Record how long shares are unreachable and whether the copy resumes. Microsoft describes this cmdlet as a way to simulate failover and to prepare for node maintenance. - Unplanned failover: power off the node that owns the role, in a test window, and time how long until
\\fs-finance\Financeanswers again. Measure it; do not quote a figure from documentation. - Performance: compare a many-small-files copy and a large-file copy against the old servers. Continuously available shares must write through to disk, so large copies can be slower than on a plain share; decide whether you need that setting from the measurements.
- Redundancy of the paths: confirm the clients use more than one network path to the cluster (SMB Multichannel, the SMB 3 feature that spreads one client's traffic across several network connections for speed and for surviving a failed one) and that the storage layer reports healthy before you decommission anything.
Pitfalls
- Pre-staged files on the destination are overwritten or deleted by SMS mirroring.
- Local users and groups used in ACLs must be migrated too (SMS has a transfer setting for local users and groups; migrated accounts arrive disabled with a random password) or replaced by domain groups, otherwise their security identifiers (SIDs) will not resolve on the new server.
- Never run
/MIRwith source and destination reversed. - Keep the old servers, untouched, until a full business cycle has passed.
- Folder Redirection (a Group Policy setting that stores users' Documents or Desktop folders on a share) points at a share path, so confirm each redirected path still resolves after cutover.
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.
A junior operations engineer needs to restart IIS and check service status on production web servers, but must not be a full administrator. How would you grant exactly that, how do you prove it works, and how do you audit what they did?
Sample Answer
Direct answer
Use Just Enough Administration (JEA), a PowerShell remoting feature that gives a user a constrained management endpoint. The junior engineer connects with their own non-admin account, sees only the commands you whitelist (check the status of the Internet Information Services (IIS) web server service, restart it), and those commands run under a temporary virtual account instead of a shared admin login. You prove it with a capability listing plus negative tests from inside a real session, and you audit it with session transcripts, PowerShell script-block events and a Windows Remote Management (WinRM) event that ties the virtual account back to the person.
Terms used below
- Constrained endpoint: a PowerShell remoting entry point that is configured to allow only a short list of commands. A JEA endpoint is one.
- NoLanguage mode: a PowerShell setting in which the user can run only the commands made visible to them, with no scripts, variables or .NET calls.
- Virtual account: a temporary local account that Windows creates for one session and deletes afterwards. Nobody knows or can reuse its password, yet commands in the session run with its privileges.
- SID (security identifier): the unique ID string Windows uses internally for an account or group, which logs show next to the name.
- Script-block logging: a PowerShell policy that writes the code PowerShell runs to the event log.
- Desired State Configuration (DSC): Windows configuration management in which you declare the state a machine should have and DSC applies it and corrects drift.
$Env:PSModulePath: the list of folders in which PowerShell looks for modules (packages of commands).- Role capability file (
.psrc) versus session configuration file (.pssc): the.psrcsays what a role may do (which commands and parameter values). The.psscsays how the endpoint behaves (session type, run-as identity, transcript folder) and which group gets which role.
Why JEA instead of the simpler options
| Option | What the junior can do | Audit trail | Verdict |
|---|---|---|---|
| Add to local Administrators | Everything, including adding accounts and installing software | Individual logons only | Too much |
Set a security descriptor (SDDL, the text form of a permissions list) on one service (Set-Service -SecurityDescriptorSddl, listed in the PowerShell 7 docs but not in the Windows PowerShell 5.1 docs) | Start or stop that one service | Service events show who changed state, nothing about other commands | Fine for a single service, no command-level control |
| JEA endpoint | Only the listed commands and parameter values | Transcript per session, script-block log, WinRM mapping event | Matches "exactly that" |
Build the endpoint
IIS has two services involved in serving HTTP: the World Wide Web Publishing Service (service name W3SVC, which configures the HTTP.sys listener) and the Windows Process Activation Service (WAS, which manages application pools and worker processes). The role lets the junior read both and restart only W3SVC.
The generator below creates both configuration files with the real cmdlets, then reads them back so you can see what was written. I ran it under PowerShell 7 on a non-Windows host (pure file generation); the output block is what it printed.
$rc = @{
Path = './IISOperator.psrc'
Description = 'Check and restart IIS services only'
VisibleCmdlets = @(
@{ Name = 'Get-Service'; Parameters = @{ Name = 'Name'; ValidateSet = 'W3SVC', 'WAS' } },
@{ Name = 'Restart-Service'; Parameters = @{ Name = 'Name'; ValidateSet = 'W3SVC' } }
)
}
New-PSRoleCapabilityFile @rc
$sc = @{
Path = './IISOperator.pssc'
SessionType = 'RestrictedRemoteServer'
RunAsVirtualAccount = $true
TranscriptDirectory = 'C:\ProgramData\JEAConfiguration\Transcripts'
RoleDefinitions = @{ 'CONTOSO\IIS-Junior-Ops' = @{ RoleCapabilities = 'IISOperator' } }
}
New-PSSessionConfigurationFile @sc
$d1 = Import-PowerShellDataFile ./IISOperator.psrc
$d2 = Import-PowerShellDataFile ./IISOperator.pssc
$d1.VisibleCmdlets | ForEach-Object { "{0} -> {1}" -f $_.Name, ($_.Parameters.ValidateSet -join ',') }
$d2.SessionType; $d2.RunAsVirtualAccount; $d2.RoleDefinitions.Keys
Get-Service -> W3SVC,WAS
Restart-Service -> W3SVC
RestrictedRemoteServer
True
CONTOSO\IIS-Junior-Ops
Reading the generator line by line:
$rc = @{ ... }builds a hashtable of settings for the role capability file, andNew-PSRoleCapabilityFile @rcpasses them all to the cmdlet at once (the@is called splatting).Pathis the file to write andDescriptionis a label.VisibleCmdletsis the allow list. Each entry names a cmdlet and, throughParameters, which parameter may be used and which values it may take.ValidateSet = 'W3SVC', 'WAS'means only those two strings are accepted for-Name.$sc = @{ ... }does the same for the session configuration file, written byNew-PSSessionConfigurationFile @sc.SessionType,RunAsVirtualAccountandTranscriptDirectoryare the three behaviour settings, andRoleDefinitionsmaps a group to a role.Import-PowerShellDataFilereads each generated file back as data (it never runs code), and the last three lines print selected values so you can see what was written. The output block above is that printout.
What each choice does:
SessionType = 'RestrictedRemoteServer'starts the session in NoLanguage mode with only a handful of default commands (Get-Command,Get-Help,Select-Object,Measure-Object,Exit-PSSessionand a few others), no providers and no external programs. The role file then adds exactly two cmdlets.ValidateSet(a PowerShell check that accepts only values from a fixed list) limits the values a parameter accepts, soRestart-Service -Name Spooleris rejected even thoughRestart-Serviceis visible. Only theNameparameter is exposed, so-DisplayNameand-InputObjectare not available either.RunAsVirtualAccount = $trueruns commands as a temporary account unique to that user and session. On a member server that account is in the local Administrators group, which is why the role file, not the account, is the security boundary.RoleDefinitionsmaps the domain group to the role by the role file's base name. Use a domain group so access is granted by group membership, not by editing the endpoint.
Windows PowerShell 5.1 finds a role file only inside a RoleCapabilities folder of a PowerShell module that sits in a folder on $Env:PSModulePath, which is why a module is needed at all: it is just the folder structure PowerShell searches, and the module itself can be empty. Place that module where untrusted users cannot write, because anyone who can edit the .psrc file can grant themselves more commands:
$modulePath = Join-Path $Env:ProgramFiles 'WindowsPowerShell\Modules\ContosoJEA'
New-Item -ItemType Directory -Path $modulePath
New-Item -ItemType File -Path (Join-Path $modulePath 'ContosoJEAFunctions.psm1')
New-ModuleManifest -Path (Join-Path $modulePath 'ContosoJEA.psd1') -RootModule 'ContosoJEAFunctions.psm1'
$rcFolder = Join-Path $modulePath 'RoleCapabilities'
New-Item -ItemType Directory $rcFolder
Copy-Item -Path .\IISOperator.psrc -Destination $rcFolder
Test-PSSessionConfigurationFile -Path .\IISOperator.pssc # must return True
Register-PSSessionConfiguration -Path .\IISOperator.pssc -Name 'IISOperator' -Force
What the module script does, line by line: the first line builds the path C:\Program Files\WindowsPowerShell\Modules\ContosoJEA (a folder on PSModulePath); the two New-Item and New-ModuleManifest lines create an empty script module and its manifest (a PowerShell module needs a file named after its folder, here ContosoJEA.psd1); the RoleCapabilities folder and Copy-Item line put the .psrc where JEA looks for it. Test-PSSessionConfigurationFile checks that the .pssc is valid, and Register-PSSessionConfiguration turns it into a live endpoint named IISOperator.
Registration restarts the WinRM service, which ends every remoting session on that machine. On production web servers, drain the node from the load balancer first, and for a fleet deploy with the JEA Desired State Configuration resource (declare the endpoint once and DSC applies and re-applies it) so every node gets the same role file. Test-PSSessionConfigurationFile and Register-PSSessionConfiguration are Windows-only and were not run here; their syntax was checked against Microsoft Learn.
Prove it works
- List what the endpoint grants a person without logging in as them:
Get-PSSessionCapability -ConfigurationName 'IISOperator' -Username 'CONTOSO\ana.ops'. The output matches what that user would see fromGet-Command -CommandType Allin the session. It reads current group membership, so it does not reflect access added through a just-in-time group system. - Connect as the junior, not as an admin:
Enter-PSSession -ComputerName web-01 -ConfigurationName IISOperator. - Run positive and negative tests and record each result. An illustrative session for the junior engineer (the exact wording of the messages varies a little between PowerShell versions) looks like this:
[web-01]: PS> Get-Service -Name W3SVC
Status Name DisplayName
------ ---- -----------
Running W3SVC World Wide Web Publishing Service
[web-01]: PS> Restart-Service -Name Spooler
Cannot validate argument on parameter 'Name'. The argument "Spooler" does not belong to the set "W3SVC"
specified by the ValidateSet attribute. Supply an argument that is in the set and then try the command again.
[web-01]: PS> Get-Process
The term 'Get-Process' is not recognized as a name of a cmdlet, function, script file, or executable program.
The second message is the one to look for: the command is visible, but the value is refused. The third shows a command that is not visible at all. The results to expect for the whole set:
| Test inside the session | Expected result |
|---|---|
Get-Service -Name W3SVC | Returns the service |
Restart-Service -Name W3SVC | Succeeds |
Restart-Service -Name Spooler | Rejected: value not in the allowed set |
Get-Process, Start-Process, net.exe | Not recognised (not visible) |
Add-LocalGroupMember -Group Administrators ... | Not recognised |
Get-Service with no -Name | Not constrained by ValidateSet because no value is supplied, so it lists every service on the server. If that is unacceptable, replace the cmdlet with a small custom function that returns only the two IIS services (shown below) |
The last row matters: a parameter constraint limits supplied values, not omitted ones, so test it rather than assume. Typing Get-Service with nothing after it would print every service (the Spooler, the firewall and so on), which goes beyond "check IIS status". The fix is to expose a function that has the two services built in and to stop exposing Get-Service itself. Generate the role file this way instead:
$rc = @{
Path = './IISOperator.psrc'
Description = 'Check and restart IIS services only'
VisibleFunctions = 'Get-IISServiceStatus'
FunctionDefinitions = @{
Name = 'Get-IISServiceStatus'
ScriptBlock = {
Get-Service -Name 'W3SVC', 'WAS' |
Microsoft.PowerShell.Utility\Select-Object Name, Status, StartType
}
}
VisibleCmdlets = @(
@{ Name = 'Restart-Service'; Parameters = @{ Name = 'Name'; ValidateSet = 'W3SVC' } }
)
}
New-PSRoleCapabilityFile @rc
$d = Import-PowerShellDataFile ./IISOperator.psrc
$d.VisibleFunctions
$d.FunctionDefinitions.Name
$d.VisibleCmdlets | ForEach-Object { "{0} -> {1}" -f $_.Name, ($_.Parameters.ValidateSet -join ',') }
Get-IISServiceStatus
Get-IISServiceStatus
Restart-Service -> W3SVC
I ran this generator under PowerShell 7 on a non-Windows host, and the output above is what it printed. Reading it: FunctionDefinitions holds the function's name and body, and VisibleFunctions is what makes it callable (a function that is defined but not listed there is hidden). The body always asks for exactly W3SVC and WAS, so the junior cannot ask about another service. The Microsoft.PowerShell.Utility\ prefix names the full Select-Object, because the one inside a JEA session is trimmed so it cannot pick arbitrary properties. Function bodies run outside the session's restrictions, so keep them short and never pass user input into Invoke-Expression. The junior now types Get-IISServiceStatus and Restart-Service -Name W3SVC, and nothing else is listed.
Audit what they did
- Transcripts.
TranscriptDirectorymakes each session write a transcript (written by the Local System account; ordinary users get no access). The header names the connecting user and the run-as identity, and each command appears as aCommandInvocationline withParameterBindinglines for its arguments. Following Learn's example, a user runningRestart-Service -Name W3SVCleaves lines likeCommandInvocation(Restart-Service): "Restart-Service"followed byParameterBinding(Restart-Service): name="Name"; value="W3SVC", and the header holdsUsername: CONTOSO\ana.opsand aRunAs Userof the formWinRM Virtual Users\WinRM VA_1_CONTOSO_ana.ops. - PowerShell event log. With module or script-block logging enabled (a Group Policy or registry setting, off unless you turn it on), the
Microsoft-Windows-PowerShell/Operationallog records event ID 4104 for each command, includingConnectedUserandRunAsUser. - WinRM event 193. The
Microsoft-Windows-Windows Remote Management/Operationallog records, for every new JEA session, the account name and security identifier (SID) of both the connecting user and the run-as virtual account. Events that applications and services write to their own logs show only the virtual run-as account, not the person, so this event (or the session transcript) is how you map "who restarted W3SVC" back to a person. - Review the configuration itself.
Get-PSSessionConfiguration | Where-Object { $_.SessionType -eq 'RestrictedRemoteServer' }finds JEA endpoints, and theRoleDefinitionsproperty shows which groups have which roles. Forward transcripts and these logs to a central store that the junior and local admins cannot edit.
Trade-offs and pitfalls
- Do not use wildcards such as
Restart-*inVisibleCmdlets; list each trusted command. - Avoid external commands like
iisreset.exe. They cannot be constrained parameter by parameter, and each needs a full path inVisibleExternalCommands. The cmdlet gives you the same result with a value list. - A user in two groups with different roles gets the most permissive merge. If two roles each set a
ValidateSeton the same parameter, the user gets both lists. - Role file names must be unique on the machine. When two files share a base name, only one is used and the choice is not alphabetical.
- Changing the user-to-role mapping means unregistering and re-registering the endpoint, which restarts WinRM again, so schedule it.
- If the virtual account is not allowed to be a local administrator (for example on a domain controller it becomes a Domain Admin), use
RunAsVirtualAccountGroupswith a narrower local group instead.
Your company wants users' profiles and data to follow them across laptops, desktops and remote session hosts. Compare roaming profiles, folder redirection and container-based profile solutions, then recommend an approach for branch users on slow links and another for pooled virtual desktops, covering the trade-offs and storage you would plan for.
Sample Answer
Direct answer
Use Folder Redirection with Offline Files (Windows keeps a cached local copy of network files, so users can keep working when the link is down and changes sync back later) for branch users on slow links, keeping any roaming profile small and limited to their own computers, because a roaming profile is copied across the link at every sign-in and sign-out. Use FSLogix profile containers (a virtual hard disk file per user (VHD or VHDX) on a file share, attached at sign-in) for pooled virtual desktops, because there the profile must follow the user to whichever machine in the pool they land on and must not be copied at all. Size container storage from measured usage, not from the per-user ceiling.
The three approaches compared
| Roaming user profiles | Folder Redirection (with Offline Files) | Container-based profiles (FSLogix, user profile disks) | |
|---|---|---|---|
| How it works | The profile loads from a file share to the local computer at sign-in, merges with any local copy, and the local copy merges back to the server at sign-out | A known folder such as Documents points at a path on a file share; applications use it as if local | A virtual disk (VHD or VHDX) holding the profile is mounted at sign-in, and a filter driver (software that sits between applications and the file system and redirects file access) makes applications see a local profile |
| Network cost | Whole profile copied at sign-in and sign-out | Files fetched as used; Offline Files caches them for offline use | No copy; reads and writes go to the disk file |
| Sign-in time on a slow link | Grows with profile size | Small, since only settings roam | Small, as nothing is copied |
| Weak points | Large profiles, profile versions differ between Windows versions | Needs a reachable server, or Offline Files to hide an outage | Depends on file share availability and storage design |
| Best for | Small settings-only profiles on a few trusted computers | Document-centric users, branch offices, mobile users | Pooled or multi-session virtual desktops |
User profile disks (the Remote Desktop Services feature that keeps each user's profile in a VHDX file on a share) are also a container approach, and Microsoft's roaming-profile article points to them for Start menu roaming on session hosts. FSLogix is the current option for pooled desktops and is not limited to virtual desktops.
Branch users on slow links
Recommendation: Folder Redirection plus Offline Files for the data, and a roaming profile only if settings must follow users between computers. Both Folder Redirection and roaming profiles can be limited to a user's primary computers, using the Group Policy settings "Download roaming profiles on primary computers only" and "Redirect folders on primary computers only" (they depend on the msDS-PrimaryComputer attribute in Active Directory, an attribute on the user's account that lists the computers designated as that user's own). That keeps profile data off shared or conference-room machines.
The cost of getting this wrong is arithmetic. Assume a dedicated 10 Mbit/s branch link, a full-rate transfer and no protocol overhead:
10 Mbit/s500 MB×8=400 s10 Mbit/s50 MB×8=40 sA 500 MB roaming profile costs about 6.7 minutes at sign-in; redirecting the large folders so the profile is 50 MB brings that to about 40 seconds. The 500 MB and 50 MB figures are illustrative; measure your own profiles. Real transfers are slower, and sign-out repeats the copy in the other direction.
Storage and share design (from Microsoft's deployment guidance):
- Deploy Folder Redirection first on existing local profiles, then roaming profiles, so profiles start small.
- Keep the roaming profile share separate from shares used for redirected folders, to prevent inadvertent offline caching of the profile folder. The share's caching mode (
New-SmbShare -CachingMode) controls offline caching. - On a clustered file share, disable continuous availability (an SMB share setting that lets open files survive a failover to another cluster node) for roaming profiles to avoid performance problems. If the share sits behind Distributed File System (DFS) Namespaces, give the folder a single target, and if DFS Replication copies it, let users reach only the source server, or users will make conflicting edits.
- Do not place Folder Redirection, home directories or roaming profiles on a Scale-Out File Server; Microsoft marks them "not recommended" there because they generate many writes that must be committed immediately. Use a File Server for general use.
- If you support two Windows versions, keep separate profile versions per OS; each gets its own folder, so profiles double in count and storage, and changes made on one version do not roam to the other. Redirect common folders so files are visible on both.
- Use the permissions Microsoft lists for the profile share: System Full control; Administrators Full control on the folder only; Creator Owner (a built-in identity that stands for whoever created the item) Full control on subfolders and files only; the user group List folder and Create folders on the folder only; everything else removed. Access-based enumeration and Encrypt data access can be enabled on the share.
Pooled virtual desktops
Recommendation: FSLogix Profile Container for each user on Server Message Block (SMB) file shares, with everything in the single profile container. FSLogix also has a separate Office container (ODFC, which holds only Office data such as Outlook and OneDrive cache); it is optional and is mainly paired with another roaming-profile product.
Settings that matter (from the FSLogix configuration reference and examples):
| Setting | Value to use | Why |
|---|---|---|
Enabled | 1 | Required |
VHDLocations | One UNC (Universal Naming Convention, \\server\share) path to the share | Where containers live |
VolumeType | VHDX | Preferred over VHD for supported size and fewer corruption cases |
SizeInMBs | Default 30000 | The maximum container size; containers are extended to it at sign-in; it can be raised later but not lowered |
IsDynamic | Default 1 | Disk usage grows only as needed, up to SizeInMBs |
ProfileType | 0 (default) | A user's container is mounted through only one connection at a time, which keeps things simple and fast |
DeleteLocalProfileWhenVHDShouldApply | 1 | Prevents a stray local profile masking the container; Microsoft warns FSLogix permanently deletes the local profile in that case, so confirm nothing needed lives only in local profiles |
ClearCacheOnLogoff (Cloud Cache only) | 1 | Saves local disk on pooled machines |
Two of these settings are marked required in Microsoft's reference, so containers do not work without them: Enabled and VHDLocations (with Cloud Cache, CCDLocations takes the place of VHDLocations). VolumeType and SizeInMBs have defaults (vhd and 30000) that this design overrides or confirms, and the other rows tune behaviour or apply only when Cloud Cache is used.
Availability: listing several paths in VHDLocations does not give resilience. Microsoft describes the list as locations to search for the user's container, and if none holds one a new container is created in the first listed location, so a user whose existing container is not found in any searched location gets a new, empty profile. Microsoft's high-availability article also states that standard containers provide no resiliency of their own and rely entirely on the storage provider, and each container still lives in exactly one location, so a lost share still stops the users whose containers are on it. For resilience use Cloud Cache (an FSLogix option that keeps a local cache and writes each container to two or more storage providers, meaning separate storage locations such as file shares or Azure storage accounts; CCDLocations lists them, with at least two), and set HealthyProvidersRequiredForRegister to 1 as in Microsoft's example so a user cannot start a local cache when a provider is down. Do not change FlipFlopProfileDirectoryName, SIDDirNameMatch, SIDDirNamePattern, VHDNameMatch or VHDNamePattern on an existing deployment, because those five settings control how FSLogix names and finds each user's folder and disk, so after a change it looks for the old containers under new names, will not find them and will create new empty profiles.
Currency note: Microsoft's FSLogix pages warn that a Windows change in the April 2026 Windows Server update, still worded as upcoming on those pages although that month has now passed, moves the default Kerberos encryption type (Kerberos is the Windows sign-in ticket protocol) from RC4, an older cipher, to AES-SHA1, a stronger encryption and integrity combination, and that file shares hosting containers that have not been upgraded to AES-SHA1 might have access problems afterwards. The link to profiles: the session host reaches the container share over SMB and proves who the user is with Kerberos tickets, so a change in the default ticket encryption can break access to the share unless the storage also supports AES-SHA1. Confirm the storage accounts and file servers hosting containers support AES-SHA1 before that update is installed, and if the session hosts already have it, check now.
Storage planning for 500 users at the default ceiling:
500×30000 MB=15000000 MBConverting that needs one stated convention. Treating a megabyte as 1,048,576 bytes (so the unit is really a mebibyte, MiB), one container is 30000 / 1024 = 29.3 GiB and the total is 15,000,000 / 1,048,576 = 14.3 TiB. Treating a megabyte as 1,000,000 bytes, the total is 15,000,000 x 1,000,000 bytes = 15 TB. These are two readings of the same 15,000,000 "MB" figure, not one quantity in two units: 15,000,000 x 1,048,576 bytes is 15.7 TB (14.3 TiB), while 15,000,000 x 1,000,000 bytes is 15 TB (13.6 TiB), a gap of about 5 percent, so state which convention you use when you order storage. Either way it is the worst case when every container reaches its maximum, not the expected usage. Because dynamic containers grow only as used, run a pilot, measure the actual size of each container, and plan on a high percentile plus headroom. For illustration, if the measured average were 8 GiB, the demand would be 500 x 8 = 4,000 GiB, which is 4,000 / 1,024 = 3.9 TiB, well below the 14.3 TiB ceiling. Use the ceiling for alerts and quotas, and use measured data for purchases. Also plan antivirus exclusions (listed in the FSLogix prerequisites) and test the share and NTFS (New Technology File System) permissions before the pilot.
Pitfalls
- Using roaming profiles for pooled desktops: sign-in and sign-out time grow with the profile, because the profile is copied each time.
- Putting containers on a share that is not highly available and calling it done; a share outage then stops every sign-in.
- Letting the working data live in the profile. Redirect or keep documents in a separate store so profile size stays bounded.
- Assuming a container's size limit can be shrunk later; it cannot, so start with a deliberate ceiling.
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.