Tag Archives: Windows

Configure Client Network Time (NTP)

Information directly copied from : https://www.cs.cmu.edu/~help/networking/ntp.html

Windows 7

Windows 7 systems benefit from using the full set of NTP servers, but cannot be configured to obtain NTP server information from DHCP. Because the control panel does not allow setting multiple servers, settings on these systems must be verified and changed from a command prompt. Systems which are members of the SCS domain will receive NTP configuration via domain group policy and should not be reconfigured.

To verify the NTP server list:

  1. Click on the Windows button
  2. In the “Search programs and files” box, type cmd and press Enter.
  3. If necessary, select cmd from the list of search results.
  4. In the command prompt window, enter w32tm /query /peers
  5. Check that an entry is shown for each of the servers listed above.

To manually configure the list of NTP servers:

  1. Click on the Windows button
  2. In the “Search programs and files” box, type cmd
  3. Right-click on cmd in the list of search results.
  4. Select Run as administrator
  5. Select Yes in the UAC dialog.
  6. In the command prompt window, enter w32tm /config /update /manualpeerlist:"NEW-PARSLEY.SRV.CS.CMU.EDU NEW-SAGE.SRV.CS.CMU.EDU NEW-ROSEMARY.SRV.CS.CMU.EDU CORIANDER.SRV.CS.CMU.EDU FENNEL.SRV.CS.CMU.EDU PAPRIKA.SRV.CS.CMU.EDU"
  7. Enter w32tm /query /peers
  8. Check that an entry is shown for each of the servers listed above.

Windows 8

Windows 8 systems benefit from using the full set of NTP servers, but cannot be configured to obtain NTP server information from DHCP. Because the control panel does not allow setting multiple servers, settings on these systems must be verified and changed from a command prompt. Systems which are members of the SCS domain will receive NTP configuration via domain group policy and should not be reconfigured.

To verify the NTP server list:

  1. Hold the windows key and press X to bring up the Power User menu.
  2. Select Command Prompt
  3. In the command prompt window, enter w32tm /query /peers
  4. Check that an entry is shown for each of the servers listed above.

To manually configure the list of NTP servers:

  1. Hold the windows key and press X to bring up the Power User menu.
  2. Select Command Prompt (Admin)
  3. Select Yes in the UAC dialog.
  4. In the command prompt window, enter w32tm /config /update /manualpeerlist:"NEW-PARSLEY.SRV.CS.CMU.EDU NEW-SAGE.SRV.CS.CMU.EDU NEW-ROSEMARY.SRV.CS.CMU.EDU CORIANDER.SRV.CS.CMU.EDU FENNEL.SRV.CS.CMU.EDU PAPRIKA.SRV.CS.CMU.EDU"
  5. Enter w32tm /query /peers
  6. Check that an entry is shown for each of the servers listed above.

MacOS X

MacOS X systems currently cannot be configured to obtain NTP server information from DHCP. Systems which are enrolled in the SCS Facilities JSS service receive correct NTP configuration via that service and should not be reconfigured. Other systems must be configured manually. To verify the NTP server list setting:

  1. Open System Preferences
  2. Click Date & Time
  3. Click on the Date & Time tab.
  4. Verify that Set Date & Time automatically is checked.
  5. In the server name field, enter NEW-PARSLEY.SRV.CS.CMU.EDU NEW-SAGE.SRV.CS.CMU.EDU NEW-ROSEMARY.SRV.CS.CMU.EDU CORIANDER.SRV.CS.CMU.EDU FENNEL.SRV.CS.CMU.EDU PAPRIKA.SRV.CS.CMU.EDU

Debian, Ubuntu

Debian and Debian-derived systems, including Ubuntu, will use NTP servers from DHCP by default when DHCP is used without NetworkManager. If NTP servers from DHCP are being used, they will be listed in the file /var/lib/ntp/ntp.conf.dhcp. If that file does not exist, then NTP servers are not being obtained from DHCP.

Unfortunately, Ubuntu systems use use NetworkManager by default, and there is a bug which prevents NTP configuration from being updated in this case. Systems running the Facilities-supported Dragon Ubuntu 12.04 or 14.04 contain a fix for this problem. On systems which are not Facilities-supported, one of two workarounds is required. Either the list of servers may be configured manually, or a simple script may be installed to enable automatic operation.

To manually configure the list of NTP servers, edit the file /etc/ntp.conf. Remove or comment out any lines beginning with the keywords “server” or “peer”, and replace them with the lines shown below. Then run service ntp restart.

  server new-parsley.srv.cs.cmu.edu  iburst
  server new-sage.srv.cs.cmu.edu     iburst
  server new-rosemary.srv.cs.cmu.edu iburst
  server coriander.srv.cs.cmu.edu    iburst
  server fennel.srv.cs.cmu.edu       iburst
  server paprika.srv.cs.cmu.edu      iburst

To enable automatic NTP configuration when using NetworkManager, you can apply a workaround similar to that used on Facilities-supported Ubuntu platforms. This is done by installing a NetworkManager dispatcher script which triggers automatic update of NTP configuration whenever a DHCP lease is obtained. Note this method will not work on older versions of Ubuntu, including Ubuntu 10.04, because they lack the required script to correctly update the NTP server configuration. To apply this workaround, install the following shell script as /etc/NetworkManager/dispatcher.d/05ntp:

#!/bin/sh

if [ "$2" = "up" -a -n "${DHCP4_NTP_SERVERS}" ] ; then
  export reason=BOUND
  export new_ntp_servers="${DHCP4_NTP_SERVERS}"
  sh /etc/dhcp/dhclient-exit-hooks.d/ntp

elif [ "$2" = "dhcp4-change" -a -n "${DHCP4_NTP_SERVERS}" ] ; then
  export reason=RENEW
  export new_ntp_servers="${DHCP4_NTP_SERVERS}"
  sh /etc/dhcp/dhclient-exit-hooks.d/ntp

elif [ "$2" = "down" ] ; then
  export reason=STOP
  sh /etc/dhcp/dhclient-exit-hooks.d/ntp
fi

exit 0

After installing the NetworkManager dispatcher script, you will need to perform one of the following actions to update NTP settings. Warning: Taking any of these actions will also result in a disruption of network access.

  • Disable and then re-enable the network interface, using either nmcli or the NetworkManager applet menu. Note that the menu location and appearance will vary depending on the Ubuntu version and desktop environment in use.
  • Restart NetworkManager by entering the command service network-manager restart
  • Reboot the system.

Fedora, RHEL

Fedora and its derivatives, including RHEL, will use NTP servers from DHCP by default when DHCP is used. For this to work, the setting PEERNTP=NO must not be present in /etc/sysconfig/network, or in the interface-specific file /etc/sysconfig/network-scripts/ifcfg-DEV, where DEV is the interface name.

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

Raspberry Pi Aquarium Controller WebUI

So after some playing around I am going for a Windows Metro style web interface for the piTank controller. At the moment the interface can be used to view the current time and date of the system, display 2 different external temperature readings and control the 8 way 10 amp 240v relay which the filter, heater, lights and alike connect to.

piTank_WebUI_1 Continue reading Raspberry Pi Aquarium Controller WebUI