Posts

DFS Namespace service not starting after a reboot

Distributed file System (DFS) has some service dependencies – so if those don’t start the DFS Namespace service will also not start.

DFS Namespace

The dependencies are:

  • Remote Registry
  • Security Accounts Manager
  • Server
  • Workstation

I have seen the Remote Registry service become the culprit of the DFS-N service not starting.

In my experience – this has been caused by antivirus software changing the Remote Registry service to Disabled start-up type so when the DFS-N server restarts, one of the dependency services:

Remote Registry does not start so if you have issues with the DFS-N service not starting – check the Remote Registry Start-up type is configured to Automatic and click Start to confirm there are no errors and try starting the DFS-N service again.

Note: RemoteRegistry – although it is Automatic, it will only Start when it is being used so don’t be alarmed if it is in a Stopped state.

Remote Registry

I have also created a quick PowerShell script to do some general checking for the DFS namespace service – sets the Remote Registry service to Automatic startup, Gets the other DFS service dependancy services and changes the startup type to Automatic and starts them and finally tries to start the DFS Namespace service.

Using PowerShell to remove Snapshots from Virtual Machines in vSphere

Although vSphere 5.5 has a scheduled task to create Snapshots, it appears to be missing a scheduled task to remove them.

I had to find a way of automating the removal of the Snapshots for specific Virtual Machines at a specific time (ie not during business hours).

To do this required 3 things, a Scheduled Task and a PowerShell script using the VMWare Snapin and a TXT document with the hostname of the Virtual Machine that needs the Snapshot to be removed.

This script is quite simple – it connects to the vSphere server, checks for a VM name under a TXT document that people add their servers to and then when the scheduled task runs it removes the Snapshot for that VM and clears the TXT document ready for the next day.

Note: You can add Credentials for the vSphere connection to the script, however I am running the script under a Service Account that has been granted Remove Snapshot rights.

Feel free to add any comments, suggestions to the comments section below.

Using PowerShell to remove App-V packages from a Windows workstation

App-V applications, usually store their data locally if they are not streamed. Sometimes an Application will have problems, either hasn’t been downloaded or some other reason.

One of the solutions that can be ran is to clear the App-V package store of a workstation, allowing you to reevaluate and download the packages back to the affected computer.

This script is pretty simple and something I made a year ago for some colleagues experiencing App-V application cache issues so decided to share it here. This requires the App-VClient PowerShell module – usually installed by default as part of the App-V client.

 

Feel free to let me know your thoughts in the comments below

Using PowerShell to setup Automatic Logon on Windows Servers

Some ‘server based’ applications require to be logged into into a service account to allow an Application or service to run, These applications usually require manual intervention by systems administrators to login to the account manually after a server restart.

There are many ways to setup Automatic Logon, using “control userpasswords2” via the Run Prompt, using Third Party utilities like LogonExpert or SysInternals Autologon for Windows  this simply using RegEdit and setting them manually.

I have created a PowerShell script for editing the registry to set this manually in a standardized way and could be ran remotely. It is pretty simple and only requires version 1 of PowerShell.

 

Read more

Windows Update Task Sequence (Patching) – SCCM 2012 R2

With monthly server patching, the process is currently manual due to the number of clusters and very application specific servers that is patched – including an issue with failed updates caused by Trend Officescan – and an issue that has been done manually for months.

It was time to automate this process – and without Orchestrator or SMA I had to use what I already had – a SCCM 2012 R2 Infrastructure, and the use of the Task Sequence and PowerShell.

WinUpdate TS TS (Patching)

The Windows Update Task Sequence process goes like this (updates are deployed to the servers as Available): Disables Trend OfficeScan Start-up type to: Disabled, run a Scheduled Task on the server (this could be emailing a business user notifying their server is going down for patching or shutting down an application – this is intended to be Server SPECIFIC so the task sequence doesn’t need to be modified for every new server getting patched), Restart the computer (this is done to make sure OfficeScan is not running and make sure the server is in a clean state for patching), and begin the patching process (see more information on the steps below).

Task Sequence Patching Steps are as follows:

Disable – Trend Office scan Services

This calls a PowerShell script which changes the Startup Type of: Office Scan NT Real-time Scan and Office Scan NT Listener services to Disable. This is changed to prevent the Trend Antivirus solution from interfering with the download and installation of Software Updates. Note: Some servers encountered issues stopping the Trend service, the restart step after this stops the Trend service from starting

Run SCHTask

This step starts a Scheduled Task “PreShutdown” that has been setup on the deployed server. This scheduled task allows for server based automation (application shutdown, business communication etc) and is specific to the server. This is a Command Line Step.

Restart Computer

This step counts down for 60 seconds and notifies the user “This server is undergoing Windows patching. Please save your work and log off” before then Restarting the computer

Scan for Updates |

This step does a WMI call to do a Software Update re-evaluation to determine if there are any new Windows Updates that are required by the system

Wait for the Scan to Finish |

This step is a PowerShell command to sleep the system for 30 seconds. This step is set to allow the Software Update re-evaluation cycle from the previous step to complete

Install Software Updates

Installs all required and available Windows Updates on the Windows server

Restart Computer

This step Restarts the computer after the first batch of patches have been installed

Scan for Updates ||

This step does a WMI call to do a Software Update re-evaluation to determine if there are any new Windows Updates that are required by the system

Wait for the Scan to Finish ||

This step is a PowerShell command to sleep the system for 30 seconds. This step is set to allow the Software Update re-evaluation cycle from the previous step to complete

Install Software Updates

Installs all required and available Windows Updates on the Windows server

Restart Computer

This step Restarts the computer after the first batch of patches have been installed

Scan for Updates |||

This step does a WMI call to do a Software Update re-evaluation to determine if there are any new Windows Updates that are required by the system

Wait for the Scan to Finish |||

This step is a PowerShell command to sleep the system for 30 seconds. This step is set to allow the Software Update re-evaluation cycle from the previous step to complete

Install Software Updates

Installs all required and available Windows Updates on the Windows server

Restart Computer

This step Restarts the computer after the first batch of patches have been installed

Scan for Updates |V

This step does a WMI call to do a Software Update re-evaluation to determine if there are any new Windows Updates that are required by the system

Wait for the Scan to Finish |V

This step is a PowerShell command to sleep the system for 30 seconds. This step is set to allow the Software Update re-evaluation cycle from the previous step to complete

Install Software Updates

Installs all required and available Windows Updates on the Windows server

Restart Computer

This step Restarts the computer after the first batch of patches have been installed

Software Update Deployment Re-Eval

This step forces the SCCM agent to “check in” and run a Compliance check on the Software Update deployment allowing for SCCM have accurate Compliance data at the end of the Task Sequence

Enable – Trend Office scan Services

This calls a PowerShell script which changes the Startup Type of: Office Scan NT Real-time Scan and Office Scan NT Listener services to Enable. This PowerShell script also Starts the services.