How to Run Script Using Windows Server

Choosing a server to set up an IT environment for running smooth business processes is crucial. Various factors need to be considered before picking the server, its operating system, and configuration parameters that suit best the business operations. These factors vary from business to business and the IT expertise (Development, IT Operations, and IT Support teams) of the company.

Run Script

The first thing while choosing the server is the platform. Windows or Linux-based servers? Budget, Sizing, and Networking requirements are finalized first before choosing the server platform. 

Out of all, budget is the core of server selection. Linux-based servers come in various distributions and expertise is required to work on Linux-based servers. 

Windows-based servers come with licenses and have a high cost of running them. Equally, the Windows server comes with advanced security, authentication, network mechanisms, and storage solutions. 

Technology advancement has reached a level where physical server hosting and data center cost of a company is moved away to the cloud. Now, virtual instances are provided by the IAAS (Infrastructure as a Service) companies and all the company is to do is – hire expertise to deploy, maintain and execute the processes using the environment given by the cloud service provider.

In this article, we are going to see the considerations when the IT team makes a choice of Windows server.

Windows Server Considerations

  • When your organization’s software applications are built on the .Net framework which is of Microsoft and built on the older versions of Windows Server, the choice to continue with the Windows server is considered while expanding the business operations.
  • The organization’s IT team resources are expertise in Microsoft Windows Server side technology. When they are more comfortable in configuring and setting up the server using the user interface. For Linux-based platforms, one should be an expert at using the command line window for configurations and setup.
  • Server sizing and licensing requirements of the organization’s clients and vendors are in line with Windows-based platforms. 
  • Microsoft Support staff and services are better in terms of Service Level Agreement (SLAs) to resolve issues in the production environment. In the case of Linux-based distributions, the team needs to resolve the issues themselves with minimal IT support.
  • Windows 2016 and Windows 2019 have advanced capabilities to meet the complex IT setup requirements in terms of application development, server administration, and network monitoring.

Let us see the advanced features of Windows servers (2016 / 2019). 

These are the latest releases of server technology offered by Microsoft. Be it virtual hosting of servers or physical installation of servers, they offer security, backup and restore, and advanced network mechanisms due to which Windows server is the choice of today’s corporate environment.

To get more details on the Windows server, you can go to

Running scripts is a routine task performed by the app deployment team, server admin or network admin of the IT team. 

Scripts are executed in various IT tasks. Some of them are listed below.

  • Jenkin scripts are used to deploy application builds in DEV and SIT environments. Jenkin is a build deployment tool that saves a lot of time for developers to deploy builds manually.
  • Backup jobs are executed by running the scripts. Data backup is a routine task and manually taking the high volume of data is a nightmare for the admin team.
  • Email notification scripts are used to send out emails to a large number of users for updates, events, or alerts.
  • For any task that requires following a set of actions at regular intervals, scripts are used to perform the action, and the scheduler is used to define how many times a day, a week, or a month, the script needs to be executed.

Scripts are very very useful in terms of saving time, avoiding manual errors, and increasing productivity.

Let us see how you run the script on Windows Server. 

NOTE: Please make sure to have administrator privileges to run any script on the Windows server. 

How to run the script using Windows Server (Jenkins for build deployments)

Jenkins is a build deployment tool that is used mostly on Linux servers. In Windows Server 2016 and Windows Server 2019, you have a PowerShell prompt that is used to run scripts using Linux commands.

To set up auto-builds, a list of steps below should be performed on your Windows server.

  1. Login to Jenkins with your username and password.
  2. Install PowerShell plugin from the Manage Plugins list item under Manage Jenkins from the left menu.
  1. Select the plugin and click “Download now…
Jenkins option

Once the plugin is installed successfully, the next step is to add PowerShell into Build. To do so:

  1. Go to the Jenkins Job page.
  2. Click Add build step from the Build page. You will see the option Windows PowerShell.
App build setup
  1. Close the window. Every time the script will be executed when your build will be made.

How to run script using Windows Server (Backup script)

If your environment is set up on Windows Server, you can run your backup scripts on daily, weekly, monthly frequency with .bat or .exe extensions. Usually backups are useful when you need to re-setup the server with data when system crash or loss of data occurs due to any reasons.

To run the backup scripts (in Windows server 2016), follow the steps below.

  1. Open Server Manager. Go to the dashboard.
Server Manager
  1. Under the Configure this local server section, click option 2 – Add roles and features.
  2. Follow onscreen instructions on the wizard that opens.
  3. Select the feature, Windows Server Backup in the 4th screen of the wizard.
Windows server backup
  1. In the screen above, it shows that the feature is already installed. Cancel and go back to the dashboard.
  2. From the tools menu on the top right, click to open the menu.
  3. Choose Windows Server Backup.
Windows server backup
  1. The local backup console opens up. 
Local Backup
  1. From the Actions pane on the right, click Backup Schedule.
  2.  Do the configuration as below on the wizard.
    • Select full server backup option.
Backup option
  1. Follow the next step to set the frequency of backup.
Backup time
  1. Follow the next step to save your backup after the script execution.
specify destination type
  1. Follow the next step to select the destination disk. 
  2. Select the external disk to store your backup. It is recommended not to keep the backup on the same server to avoid the backup loss incase of disaster.
destination disk
  1. Click the highlighted button and select the disk.
  2. A pop up message is shown as below.
Windows server backup
  1. OK and continue.
  2. Another popup is shown asking you to continue. Say Yes.
  1. See the summary of your backup schedule you have set up.

Close the pop up and your backup will run automatically based on the schedule.

How to run the batch script using Windows Server 

To execute the computer startup script for all the employees registered under Active Directory, you can perform the following steps:

NOTE: Running this script at scheduled time will start the computers automatically.

  1. Open Server Manager.
  2. Choose Group Policy Management form the Tools menu on the top right.
  3. From the console, open the Active Directory tree.
  4. Choose the GPO (Group Policy Object) container.
  5. Create a new object, give the name Startup and OK.
  6. Add the script to the GPO.
    • From the GPM editor, go to the computer configuration → policies.
    • Select Scripts from the right side pane.
    • On the tab, you will see startup.bat. 
    • Choose the script and apply. 
  7. The script will be executed as per commands set in the startup.bat script.

Window Server gives the option to use User Interface to create and execute scripts via wizard or via GPO or via command prompt of Administrator console. Life is a little easy when we talk about running scripts in Windows Server.

You may also like: