Windows server 8 apps must run without a gui learn more now
1 / 34

Windows Server 8 apps must run without a GUI - learn more now - PowerPoint PPT Presentation

  • Uploaded on

SAC-416T. Windows Server 8 apps must run without a GUI - learn more now. Jeffrey Snover Distinguished Engineer and Lead Architect of Windows Server Andrew Mason Principal Group Program Manager. Windows Server History. Prior to Windows Server 2008, full GUI at all times

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
Download Presentation

PowerPoint Slideshow about 'Windows Server 8 apps must run without a GUI - learn more now' - topaz

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
Windows server 8 apps must run without a gui learn more now l.jpg


Windows Server 8 apps must run without a GUI - learn more now

Jeffrey Snover

Distinguished Engineer and Lead Architect of Windows Server

Andrew Mason

Principal Group Program Manager

Windows server history l.jpg
Windows Server History

  • Prior to Windows Server 2008, full GUI at all times

  • WS08 introduced Server Core which minimized:

    • Servicing

    • Security attack surface

    • Resource consumption

    • Deployment overhead

  • Critical patches reduced by 50-70% from full GUI install

  • However

    • One time install choice: full or core

    • Limited application compatibility

    • Limited local manageability

In the past windows has been a great os for a server and its devices l.jpg

In the past, Windows has been a great OS for a serverand itsdevices

Slide4 l.jpg

Windows Server 8 is a great OS for lots of servers and the devices connectingthemwhether they are physicalorvirtualwhether they are on-premise or off

Windows server 8 is the best cloud optimized os l.jpg

Windows Server 8 is the best Cloud Optimized OS

A cloud optimized os requires l.jpg
A Cloud Optimized OS requires

  • Low friction deployment

    • Just Enough Server: install only what is absolutely needed to minimize

      • Security footprint

      • Serviceability footprint

      • Resource footprint

  • Multi-Machine Automation

    • Uniform, remote, lights-out management

  • Modern multi-machine management GUIs

    • Consuming lots of CPU and running on Client machines

Guis on servers are evil l.jpg
GUIs on Servers Are Evil

  • Low friction deployment

    • Require large amounts of code to support the GUI

  • Multi-Machine Automation

    • Often call private APIs instead of public formal management APIs

    • Thwarts remote management which thwarts multi-machine management

  • Modern multi-machine management GUIs

    • Require GPUs

    • Takes large amounts of resources away from the server workload

Windows server 8 deployment options l.jpg
Windows Server 8 Deployment Options

  • Full Server UI option provided for backwards compatibility

  • Server Core is the preferred deployment configuration

    • RSAT for remote GUI management

    • PowerShell support achieves critical mass with 2300+ cmdlets

    • More roles, features available

  • NEW Full Server without Server Graphical Shell

    • No Explorer, Internet Explorer or associated files

    • MMC, Server Manager, and a subset of Control Panel applets are still installed

    • Provides many of the benefits of Server Core for those applications or users that haven’t yet made the transition

  • NEW Can move between Server Core and Full Server by simply installing or uninstalling components

Slide9 l.jpg

Server Core is the preferred deployment configuration

Server core is ready for the mainstream l.jpg
Server Core is Ready for the Mainstream

WS08 & WS08/R2

Windows 8


PowerShell with > 2430 cmdlets

Remote install/config of roles via Server Manager, Powershell, WMI

Role Support

13 roles

SQL Denali support


Migrate between core and full server by adding/removing components

  • Manageability

    • No PowerShell in WS08

    • Powershell with ~230 cmdlets in WS08/R2

    • No Remote install/config of roles

  • Role Support

    • 10 roles in WS08/R2

  • Flexibility

    • Install Core or Full Server with no migration between them

Transitioning between server core and full server l.jpg
Transitioning between Server Core and Full Server

  • PowerShell cmdlets

    • Full Server to Server Core

      • Import-Module Dism

      • Disable-Feature –online -FeaturenameServerCore-FullServer

    • Server Core to Full Server

      • Import-Module Dism

      • Enable-Feature –online -FeaturenameServerCore-FullServer,Server-Gui-Shell,Server-Gui-Mgmt

  • DISM

    • Full Server to Server Core

      • Dism /online /disable-feature /featurename:ServerCore-FullServer

    • Server Core to Full Server

      • Dism /online /enable-feature /featurename:ServerCore-FullServer /featurename:Server-Gui-Shell /featurename:Server-Gui-Mgmt

Reducing on disk footprint l.jpg
Reducing on Disk Footprint

  • Roles and Features can be removed from the WinSXS folder

    • PowerShell: Disable-Feature –online … … –Remove

    • Dism: Dism/online /disable-feature … … /remove

  • Can be reinstalled from Windows Update or a WIM

    • PowerShell: Enable-Feature –online … … –Source x:\wim

    • Dism: Dism/online /enable-feature … … /source:x:\wim

Optional server graphical shell l.jpg
Optional Server Graphical Shell

  • Full Server without Explorer and Internet Explorer

    • Provides some of the benefits of Server Core for those products or admins that can’t fully make the transition to Server Core

    • Can run Server Manager, MMC, local admin GUIs and some Control Panel Applets

  • Enables developers to begin shifting their applications to support headless servers

    • Remove Shell dependencies

    • Ensure full remote management

    • Aligned with Server futures

    • Enhanced availability

Uninstalling server graphical shell l.jpg
Uninstalling Server Graphical Shell

  • Server Manager, under the Features UI

  • PowerShell cmdlets

    • Uninstall

      • Import-Module ServerManager

      • Remove-WindowsFeature Server-Gui-Shell -Restart

    • Install

      • Import-Module ServerManager

      • Add-WindowsFeature Server-Gui-Shell -Restart

  • DISM /online /disable-feature /featurename:Server-Gui-Shell

Minimal server interface l.jpg


Minimal Server Interface

Server graphical shell capabilities l.jpg
Server Graphical Shell Capabilities

  • If you do not install the Server Graphical Shell, there is

  • No Explorer Shell, Task Bar, or System Tray

    • E.g. explorer.exe, systray.exe, themeservice.dll

    • Common dependency issues

      • Shell namespace extension APIs

      • Common dialog boxes

  • No Internet Explorer or Help

    • E.g. iexplore.exe, mshtml.dll,

Common dialog box control is limited l.jpg
Common Dialog Box Control is Limited

OPENFILENAME ofn = { 0 };


ofn.lpfnHook = HookProcOldStyle;


// The callback HookProcOldStyle is as follows


HWND hdlg,

UINT uiMsg,

WPARAM wParam,




    // This is a dummy hook proc to force non-Explorer style dialogs

    // Just return FALSE to allow standard dialog to handle messages

    return FALSE;


  • Common Dialog box is functional with the exception of Networking

    • If not a common scenario, no changes needed

    • If a common scenario, use old style common dialog box

  • To display old-style dialogs pass in an old-style hook function and do not specify OFN_EXPLORER

Shell namespace extensions apis l.jpg
Shell Namespace Extensions APIs

  • Any UI with dependencies on items implemented as Shell Namespace Extensions will fail

    • Shell Namespace Extensions are described at:


  • Certain CPLs are namespace extensions

    • Check for dependencies on namespaces extensions

    • Applications should re-targeted at the appropriate PowerShell or command line option

    • Primary examples are the CPLs for Firewall, Windows Update, and Windows Networking

Internet explorer l.jpg
Internet Explorer

  • Internet Explorer is not available when Server Graphical Shell is uninstalled, for example

    • IELaunchURL() (ieframe.dll)

    • IHTMLWindow*, IHTMLDocument* (mshtml.dll)

  • Code can be modified to check for Server Graphical Shell and if not available display a message stating that it is required.

  • If you are querying the IE version (HKLM\SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\Version), you must fail gracefully when not present.

No help system l.jpg
No Help System

  • Check & modify your help menu options and buttons

  • HtmlHelp() will return NULL as the hWnd of the help viewer.

    • Occurs in both Minimal Server Interface and Server Core

  • Existing code using HtmlHelp() returns NULL

    • Fail gracefully, e.g. display a message box to saying help is not available.

  • New code using HtmlHelp() or other help mechanisms, either:

    • Do not display option to invoke help in the UI

    • Use a wrapper function which can either invoke help using a dynamic dependency (e.g. LoadLibrary() or delayload), or display the "help not available" message box.

Silent help failures l.jpg
Silent Help Failures

  • When trying to start help nothing happens, there is no error message. Common causes are:

    • When launching help, loading hhctrl.ocx which queries the IE version (HKLM\SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\Version) and fails.

    • Help tabs disappearing when clicking on help – occurs with loading hhctrl.ocx which queries the IE version and fails.

    • Using a help viewer that tries to load IEFrame.dll (CLSID 8856F961-340A-11D0-A96B-00C04FD705A2)

    • Using the help viewer from Microsoft Visual Studio (dexplore.exe) which attempts to load ieproxy.dll which is no longer installed.

Server graphical shell coding best practices l.jpg
Server Graphical Shell Coding Best Practices

  • Ideal Solution - Run on Server Core

    • Have no dependencies on Full Server or Server Graphical Shell

    • For native code, use the lowest level Win32 APIs available

    • For managed code, limit to Server Core subset if Server Core is supported

    • Primarily test on Server Core

    • Enable remote management using WS-Management and PowerShell cmdlets

Server graphical shell coding best practices cont l.jpg
Server Graphical Shell Coding Best Practices (cont)

  • Interim solution phase – Run on Server Core with some optional Server Graphical Shell dependencies

    • Make Server Graphical Shell dependencies optional via delay load

    • Detect if running on Server Core or the minimal server interface

    • If so, do not use any Server Graphical Shell code paths

    • Primarily test on lowest level supported, e.g. Server Core or minimal server interface

  • If you have functionality that requires the Server Graphical Shell

    • Make functionality optional and installable only with Server Graphical Shell

Detecting the state of server graphical shell l.jpg
Detecting the state of Server Graphical Shell

  • Using the Registry

    • HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Server\ServerLevels

    • If only ServerCore=1 is set = Server Core

      • ServerCore=1 set by the foundation, always set in Windows Server 8

    • If Server-Gui-Mgmt=1 is set and Server-Gui-Shell is not set = Minimal Server Interface

    • If both Server-Gui-Mgmt=1 and Server-Gui-Shell=1 = Full Server

  • Using the DISM APIs

    • Calling code must be running elevated

    • Requires C/C++

    • Approach: enumerate features, record state of relevant features, evaluate overall Server state

    • #include <dismapi.h>, link to dismapi.lib

Dism api sample l.jpg

hr= DismInitialize( DismLogErrorsWarningsInfo, NULL /* Optional path to logfile */ , NULL /* Optional path to scratch directory */ );

DismSession session;

hr = DismOpenSession( DISM_ONLINE_IMAGE, NULL /* for DISM_ONLINE_IMAGE */ , NULL /* for DISM_ONLINE_IMAGE */ , &session );DismFeature *pDismFeaturesList;

UINT dismFeaturesCount;

hr = DismGetFeatures( session, NULL /* no optional Identifier */ , DismPackageNone /* no optional Identifier */, &pDismFeaturesList, &dismFeaturesCount ); for( UINT i=0; i < dismFeaturesCount; i++ ) {

if ( ! bFoundServerGuiShell && (_wcsicmp(L"Server-Gui-Shell", pDismFeaturesList[i].FeatureName) == 0) ) {

bFoundServerGuiShell = true;

if ( DismStateInstalled == pDismFeaturesList[i].State ) {

bEnabledServerGuiShell = true;


} // … Similarly for bEnabledServerGuiMgmt, bEnabledServerCoreFullServer

} if ( ! bEnabledServerCoreFullServer ) {

wprintf( L" Server Core\n" );

} else if ( bEnabledServerGuiMgmt && bEnabledServerGuiShell ) {

wprintf( L" Full Server" );

} else if ( bEnabledServerGuiMgmt && ! bEnabledServerGuiShell ) {

wprintf( L" MinShell" );

} else {

wprintf( L" Other sub-Full-Server configuration" );


hr = DismDelete( pDismFeaturesList ); // Delete structure returned by DISM APIhr = DismCloseSession( session );

hr = DismShutdown();

Troubleshooting existing code l.jpg
Troubleshooting Existing Code

  • Ensure your code runs on a Full Server with Server Graphical Shell installed

  • If it does, but not on the minimal server interface or Server Core, it is likely a missing dependency:

    • Missing DLL – use a debugger or a tool like Process Monitor

    • Missing Registry value – use a debugger or a tool like Process Monitor

Troubleshooting existing code cont l.jpg
Troubleshooting Existing Code (cont)

  • List static file dependencies

    • dumpbin /dependents <filename>

  • List API imports from each of the dependents files

    • dumpbin /imports <filename>

  • List API imports from the specified dependent file

    • dumpbin /imports:<dependent file> <filename>

  • Enable loader snaps to see what the loader is doing


    • gflags.exe -i your-app.exe +sls

    • windbg.exe your-app.exe

  • Call to action l.jpg
    Call to Action

    • Join the Windows Server direction for the datacenter!

      • Modify your apps/drivers to install and run on Server Core

      • Do not install GUI tools by default – make them optional

      • Write PowerShell Cmdlets to ensure it can be completely managed locally and remotely

        • WMIV2 or managed code

        • WS-Management

      • Write rich admin GUIs layered on top of PowerShell and install them on Windows Client

      • Profile and understand your dependencies

    Feedback and q uestions http forums dev windows com session f eedback http bldw in sessionfeedback l.jpg

    thank you

    Feedback and questions

    Session feedback

    Slide32 l.jpg

    © 2011 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.

    The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

    Dlls removed by server gui shell l.jpg
    DLLs Removed by Server-Gui-Shell



















































































    \Program Files\Common Files\Microsoft shared\VGX\VGX.dll

    \Program Files\Common Files\System\wab32.dll

    \Program Files\Common Files\System\wab32res.dll

    \Program Files\Internet Explorer\hmmapi.dll

    \Program Files\Internet Explorer\iedvtool.dll

    \Program Files\Internet Explorer\ieproxy.dll

    \Program Files\Internet Explorer\IEShims.dll

    \Program Files\Internet Explorer\jsdbgui.dll

    \Program Files\Internet Explorer\jsdebuggeride.dll

    \Program Files\Internet Explorer\JSProfilerCore.dll

    \Program Files\Internet Explorer\jsprofilerui.dll

    \Program Files\Internet Explorer\msdbg2.dll

    \Program Files\Internet Explorer\networkinspection.dll

    \Program Files\Internet Explorer\pdm.dll

    \Program Files\Internet Explorer\sqmapi.dll

    \Program Files\Windows Mail\wabfind.dll

    \Program Files\Windows Mail\wabimp.dll