Category Archives: MS Windows

Windows Server 2012 R2, Missing DNS Entries, Solved

For some reason, I just couldnt see why it was happening, Windows Server 2012 R2 DNS AD DC dns entries just disappearing! It started with one, I clicked refresh, and they all dissapeared.

Sometimes you just need to go back a couple of steps, and remember that you have selected a Filtered View. It was only when adding a test DNS entry, the system said the record was already added, but where!?

Continue reading Windows Server 2012 R2, Missing DNS Entries, Solved

MS Windows Query Internet Explorer Version

The below script will remotely query MS Windows 7+ for what version of Internet Explore a PC has installed.

Download PSEXEC here

How to use:

Ensure you have PSEXEC installed and ready for use,  more info here

Save the below to a ‘.bat’ file of whatever name you like. On running the batch file you will be asked for a hostname, enter the hostname and press the enter key.

Once the Enter key is selected the system will return what version of IE is installed on the remote PC.

 

@echo off
REM *********************************************
REM A.Nicholls
REM http://www.adienicholls.co.uk/blogs
REM 25/05/2016
REM *********************************************

:start
REM Get remote PCs hostname
set /p id=Enter Hostname:

psexec \\%id% -h cmd /c reg query "HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer" /v "svcVersion"

Goto Start
:end

MS Windows Remote Installs

Use this script to run a program remotely. In this scenario the script is used to install IE9 onto a remote MS Windows 7 machine.

PSTools Download Link

How to use:

Save the below script as a ‘.bat’ file.
Update the script to reflect the network share where the IE9 (or other) install / upgrade package is stored.

On running the script you will be shown a CMD box asking for an asset tag (also known as hostname). Enter the PC asset tag, select Enter… The Script will connect to the remote computer, copy the installation file over to a C:\temp folder, run the installer using the switches provided and the delete the file once completed.

The script should return an ‘error’ code of 0, this means the installation completed with no issues.

 

@echo off
REM *********************************************
REM A.Nicholls
REM http://www.adienicholls.co.uk/blogs
REM 25/05/2016
REM *********************************************

REM Get remote PCs hostname
set /p id=Enter Hostname:

REM Copy the install file from source to destination PC
robocopy \\Server\shared\ms\ie9 \\%id%\c$\temp\ *.exe /r:0 /w:0

REM executes the copied file through CMD
psexec \\%id% cmd.exe /c "c:\temp\IE9-Windows7-x86-enu.exe" /quiet /closeprograms /update-no /norestart

REM verifying return codes
ECHO ________________________________________________________________
ECHO (1)     Error, opps something went wrong
ECHO (0)     Installation Succeeded
ECHO ________________________________________________________________

REM Cleanup - Delete the previously copied file
psexec \\%id% cmd.exe /c DEL "c:\temp\IE9-Windows7-x86-enu.exe" /q

REM providing a cleaner exit code for the file deletion
if ERRORLEVEL 1 echo *****OOPS, couldnt remove the file*****
if ERRORLEVEL 0 echo cleanup completed

pause

MS Windows Remotely Delete Profile Script

Use the below script to run a profile cleanup on a remote computer running MS Widows Vista or newer

You will need to download DelProf2 and save it to your PC or a shared network location. Download from here

How to use:

Save the below script as a ‘.bat’ file, Update the robocopy path of where your delprof2 application is being stored.

Running the batch file will present a CMD window asking for the asset tag (also known as hostname) of the PC this task is to be run on.

On entering an asset tag the script will start the remoteregistry service of the remote PC, copy the DelProf2 application across to the local PC and then run the program using the defined criteria

To customize the DelProf2 criteria see the above link for syntax and examples.

 

@echo off
REM *********************************************
REM A.Nicholls
REM http://www.adienicholls.co.uk/blogs
REM 25/05/2016
REM *********************************************

REM Get remote PCs hostname
set /p id=Enter Hostname:

REM this line starts the remote registry service
psexec \\%id% cmd.exe /c "net start remoteregistry"

REM Copies the DelProf application to your local PC
robocopy \\Servername\Shared\DelProf c:\ DelProf2.exe /r:0 /w:0


REM Executes DelProf with a config
C:\DelProf2.exe -c:%id% /u /ed:admin* /d:90

pause