Create the PostIC.cmd File for Running Post Initial Configuration Tasks
Applies To: Windows Server 2016 Essentials, Windows Server 2012 R2 Essentials, Windows Server 2012 Essentials
You can add post-initial configuration customizations by writing your own code, and then calling that code from a script file named PostIC.cmd. When using the PostIC.cmd file, you must adhere to the following guidelines:
Your customization code must run silently (it cannot display a User Interface).
Your customization code cannot initiate a restart of the server. The Initial Configuration will restart the server as the last task.
Your customization code must run in three minutes or less.
Define your PostIC.cmd file to return a 0 if the code runs successfully. If any other value is returned, the operating system looks for a file named SetupFailure.cmd, which contains code that should be run if the code in the PostIC.cmd file does not run successfully. Both the PostIC.cmd file and the SetupFailure.cmd file must be located C:\Windows\Setup\Scripts.
To define post-initial configuration customizations
Write the code that is called from the PostIC.cmd script.
Using Notepad, create a file called PostIC.cmd and add the call to the code that you created in step 1. Ensure that your code returns a success value.
Save PostIC.cmd in C:\Windows\Setup\Scripts.
(Optional) Create a SetupFailure.cmd file which runs code if PostIC.cmd returns anything other than 0.
You can provide notification of problems in Initial Configuration by using the SetupFailure.cmd. The SetupFailure.cmd file contains the code that you want to run if problems occur. The SetupFailure.cmd file is placed in C:\Windows\Setup\Scripts and is run when either a problem occurs with a setup task or when the PostIC.cmd file returns a value other than 0.
To define notifications
Write the code that is called from the SetupFailure.cmd script.
Using Notepad, create a file called SetupFailure.cmd and add the call to the code that you created in step 1. Ensure that your code returns a success value.
Save SetupFailure.cmd in C:\Windows\Setup\Scripts.