Remotely Lock & Shutdown computers using PowerShell

PowerShell takes the functionality of batch scripts to the next level and allows you to Remotely Lock & Shutdown computers using PowerShell.

The following needs to be run on each computer if using a workgroup setup. or changed in your AD security policy (to make it permanent – which isn’t advisable without signing the script)

Set-executionpolicy unrestricted
Set-Item WSMan:\localhost\Client\TrustedHosts -Value "" -Force 
Get-Item WSMan:\localhost\Client\TrustedHosts
Restart-Service WinRM

The above does the following:
Enable-PSRemoting sets up the policies and firewalls to allow remote connections using powershell
Set-executionpolicy unrestricted changes the local execution policy to allow execution of all scripts (not just signed)
Set-Item WSMan:\localhost\Client\TrustedHosts -Value "" -Force Adds server IP into the trustedhosts to allow execution
Restart-Service WinRM restarts windows remote management service

We are assuming that your server IP is, change as appropriate

Now to the actual shutdown code that will be run from our “Server”:

Function Get-MyCredential{

 $secStr = new-object -typename System.Security.SecureString
 $password.ToCharArray() | ForEach-Object {$secStr.AppendChar($_)}
 return new-object -typename System.Management.Automation.PSCredential -argumentlist $username,$secStr
Function Lock-Machine{

 & winrm set winrm/config/client `@`{TrustedHosts = `"$machineName`"`}
 Invoke-Command -ComputerName $machineName -ScriptBlock { tsdiscon.exe console } -Credential (Get-MyCredential User Pa$W0rd)
Function Hibernate-Machine{

 & winrm set winrm/config/client `@`{TrustedHosts = `"$machineName`"`}
 Invoke-Command -ComputerName $machineName -ScriptBlock { &"$env:SystemRoot\System32\rundll32.exe" powrprof.dll,SetSuspendState Hibernate } -Credential (Get-MyCredential Administrator password)
Lock-Machine ""
#Lock-Workstation "NameOfTheComputer" (Get-Credential)
Stop-Computer -ComputerName -Force -Credential (Get-MyCredential User Pa$W0rd)

Relaunching a windows app using a batch script

We recently had need to restart an app server exe automatically when the demonstration license it was running on caused the server to close regularly, annoying everyone trying to learn the system. We had need of a script (YAY) to check if it was running and restart it when required.


  1. Check to see if the app is running on start if not running, start it.
  2. wait for some period of time (60 seconds)
  3. Check to see if the app is running, if not running, start it


  1. Date app last restarted is displayed in title
  2. ability to close script with a button press
  3. ability to cancel wait time and relaunch app now
  4. ability to log when app was restarted

Working on it:

checking if a process is running:

It turns out that checking if a process is running is relatively easy:

tasklist /FI "IMAGENAME eq appServer.exe" | findstr "appServer.exe"
if %ERRORLEVEL% == 1 Echo No server Process found
if %ERRORLEVEL% == 1 goto start

and of course, now you have to choose:

if %ERRORLEVEL% == 1 goto loop

now we start the exe

start "" "C:\Program Files (x86)\AppVision 4.0\Bin\appServer.exe"

Set the title

title appServer (re)Started at %NowDate% %NowTime% (Press X to exit script before closing appServer.exe)

Pulling it all together:

@echo off
title appServer (re)Launching script started at %time:~0,2%_%time:~3,2%_%time:~6,2% (Press X to exit script before closing appServer.exe)
pushd "C:\Program Files (x86)\AppVision 4.0\Bin"

timeout 2 >NUL
rem ping -n 2 >NUL
tasklist /FI "IMAGENAME eq appServer.exe" | findstr "appServer.exe"
if %ERRORLEVEL% == 1 Echo No server Process found
if %ERRORLEVEL% == 1 goto start
echo Server process found at %time%, waiting 60 seconds
rem timeout 60
rem ping -n 30 >NUL
rem echo %ERRORLEVEL%
if %ERRORLEVEL% == 1 goto loop
goto eof

set NowTime=%time:~0,2%_%time:~3,2%_%time:~6,2%
set NowDate=%date:~10,4%_%date:~4,2%_%date:~7,2%

echo starting
start "" "C:\Program Files (x86)\AppVision 4.0\Bin\appServer.exe"
title appServer (re)Started at %NowDate% %NowTime% (Press X to exit script before closing appServer.exe)
rem ping -n 11 >NUL
goto loop

echo script finished due to keypress
rem pause

ASTARO – Adding Win 2k3 as a Authentication server

This article was originally found at ““. We have updated it, because the original was a little light on information, and is considered outdated now.

This was created in a hope that others can get more information, and not have to spend as much time as me, tracking down issues and piecing everything together (not being an expert on RADIUS Authentication)

Step 1 – Add a usergroup to Authenticate against

  • Open Computer Management (Start/All Programs/Administrative Tools/Computer Management),
  • Add a new Usergroup and give it a descriptive and helpful name (I suggest something like “Gateway Users”).

Step 2 – Add users to your group

  • Within Computer Management (System Tools/Local Users and Groups/Users), create users (if necessary)
  • Right click on a user and select Properties
  • Under the Member Of tab, add the group that you created in Step 1 (eg “Gateway Users”)
  • Do Not close Properties dialog box, go to step 3.

Step 3 – Configure Dial-in access

  • Within Properties dialog box, click on the Dial-in tab.
  • choose “Allow Access” under Remote Access Permission (Dial-in or VPN)
  • Save and close the Properties dialog box.

Step 4 – Alter Group Policy for password encryption

  • Within Active Directory Users and Computers, right click on your domain name and chose properties
  • Within the Domain Properties dialog box click Group Management tab
  • Highlight the Default Domain Policy and select “edit”
  • In the GPO Editor, navigate to Computer Configuration/Windows Settings/Security Settings/Account Policies/Password Policy
  • Make sure Store passwords using reversible encryption is enabled
  • Save and close all dialog boxes

Step 5 – Add a client to the IAS RADIUS server

  • Open IAS (Start/All Programs/Administrative Tools/Internet Authentication Server)
  • Right click on RADIUS Clients then chose New RADIUS Client
  • Gave the Client a friendly name of ASG and an IP address
  • Chose RADIUS Standard Vendor-Client and inputted my shared secret (note: will need to input this on the ASG, so write it down)

Step 6 – Create a new Remote Access Policy

  • Within IAS, right click on Remote Access Policies and Choose New Remote Access Policy
  • In the wizard, Choose Set Up Custom Policy and give the policy a descriptive name
  • Select the NAS-Identifier policy condition and give the NAS ID of pptp (lowercase)
  • Select the Windows-Groups policy condition as well and add the group specified in Step 1
  • Choose Grant Remote Access
  • Edit the profile to include CHAP on the Authentication tab (You can include PAP as well, but this is an insecure method)
  • Save and close all configurations on the Active Directory server

Step 7 – Configure the ASG

  • Navigate to Definitions & Users/Authentication Servers/Servers
  • Add the server, service port (keep default unless absolutely certain) and shared secret from Step 5
  • Save the configuration

You are now done with the configuration. In a few minutes, at most, you should be able to use the RADIUS server to authenticate to ASG facilities. If there is an issue where authentication continually fails, most likely there is a setting on the AD server that needs to be adjusted.

Advanced Settings

If you wanted to get fancy, you could do the following:

Setup a Group for each part of the ASTARO Secure Gateway components (such as Proxy, VPN, Webadmin, etc)

Setup a Remote Access Policy which mimicks the above, while adding “NAS-Identifier” as an extra step. ASTARO sends a unique identifier for each part, so you can setup groups within windows to authorise access to whatever you want, and then you no longer need to edit users at the ASG Web Admin.

This requires setting up “Automatic User Creation” (Definitions & Users/Authentication Servers/Global Settings).


Use the Test feature of the Edit Authentication Server Page to check if the user is getting authorisation.

Use the Event viewer on the server to check the “System” Logs, Failed Logon events will show further details here (as long as ASG is setup with the correct server details. is a good place to start for troubleshooting various items on the windows side.

Opening ISO CD/DVD image files

We often get asked how to get information from an .ISO .bin or other type of CD / DVD image file, so here are the easiest ways we know of.

  1. Mount the ISO as though it was burnt to a CD/DVD and inserted into a drive on your PC
  2. Extract all files from the image to a directory on your PC

Mount the CD/DVD Image

Download and install Virtual CloneDrive from slysoft, double click on your file and start browsing.

Extract the files

Download and install Universal extractor, then right mouse click on the file and choose extract, select a location, and kick back and relax for a minute or two while the magic happens.

How Compact Disks are Made

Have you ever wondered how all those CDs & DVDs are made ?

this discovery channel video shows you exactly how its done (its a bit old now, but i’m sure the process is still similar).

RJ45 Cat 5 cable pin-outs

Ethernet RJ45 Socket 10baseT Colour Code
Pin No Description Colour
1_____TX +_______Orange/White
2_____TX -_______Orange
3_____RX +_______Green/White
6_____RX -_______Green

RJ45 Cross Over Cable 10baseT
RJ45 Male RJ45 Male

RJ45 100base-T4 Crossover male to male

It’s important that each pair is kept as a pair. TX+ & TX- must be in
the pair, and RX+ & RX- must together in another pair etc. (Just as
the table above shows).

HTML 4.0 Symbols

Many People still use editors that either don’t have or have limited access to symbols, but still need to put them into HTML from time to time (like myself).

Below is a small table of some Symbols, their HEX and Decimal Values.
The Complete original table is found HERE on … give credit where its due.

Character Entity Decimal Hex Rendering in Your Browser
Entity Decimal Hex
Latin small f with hook = function = florin ƒ ƒ ƒ ƒ ƒ ƒ
Greek capital letter alpha Α Α Α Α Α Α
Greek capital letter beta Β Β Β Β Β Β
Greek capital letter gamma Γ Γ Γ Γ Γ Γ
Greek capital letter delta Δ Δ Δ Δ Δ Δ
Greek capital letter epsilon Ε Ε Ε Ε Ε Ε
Greek capital letter zeta Ζ Ζ Ζ Ζ Ζ Ζ
Greek capital letter eta Η Η Η Η Η Η
Greek capital letter theta Θ Θ Θ Θ Θ Θ
Greek capital letter iota Ι Ι Ι Ι Ι Ι
Greek capital letter kappa Κ Κ Κ Κ Κ Κ
Greek capital letter lambda Λ Λ Λ Λ Λ Λ
Greek capital letter mu Μ Μ Μ Μ Μ Μ
Greek capital letter nu Ν Ν Ν Ν Ν Ν
Greek capital letter xi Ξ Ξ Ξ Ξ Ξ Ξ
Greek capital letter omicron Ο Ο Ο Ο Ο Ο
Greek capital letter pi Π Π Π Π Π Π
Greek capital letter rho Ρ Ρ Ρ Ρ Ρ Ρ
Greek capital letter sigma Σ Σ Σ Σ Σ Σ
Greek capital letter tau Τ Τ Τ Τ Τ Τ
Greek capital letter upsilon Υ Υ Υ Υ Υ Υ
Greek capital letter phi Φ Φ Φ Φ Φ Φ
Greek capital letter chi Χ Χ Χ Χ Χ Χ
Greek capital letter psi Ψ Ψ Ψ Ψ Ψ Ψ
Greek capital letter omega Ω Ω Ω Ω Ω Ω
Greek small letter alpha α α α α α α
Greek small letter beta β β β β β β
Greek small letter gamma γ γ γ γ γ γ
Greek small letter delta δ δ δ δ δ δ
Greek small letter epsilon ε ε ε ε ε ε
Greek small letter zeta ζ ζ ζ ζ ζ ζ
Greek small letter eta η η η η η η
Greek small letter theta θ θ θ θ θ θ
Greek small letter iota ι ι ι ι ι ι
Greek small letter kappa κ κ κ κ κ κ
Greek small letter lambda λ λ λ λ λ λ
Greek small letter mu μ μ μ μ μ μ
Greek small letter nu ν ν ν ν ν ν
Greek small letter xi ξ ξ ξ ξ ξ ξ
Greek small letter omicron ο ο ο ο ο ο
Greek small letter pi π π π π π π
Greek small letter rho ρ ρ ρ ρ ρ ρ
Greek small letter final sigma ς ς ς ς ς ς
Greek small letter sigma σ σ σ σ σ σ
Greek small letter tau τ τ τ τ τ τ
Greek small letter upsilon υ υ υ υ υ υ
Greek small letter phi φ φ φ φ φ φ
Greek small letter chi χ χ χ χ χ χ
Greek small letter psi ψ ψ ψ ψ ψ ψ
Greek small letter omega ω ω ω ω ω ω
Greek small letter theta symbol ϑ ϑ ϑ ϑ ϑ ϑ
Greek upsilon with hook symbol ϒ ϒ ϒ ϒ ϒ ϒ
Greek pi symbol ϖ ϖ ϖ ϖ ϖ ϖ
bullet = black small circle • • •
horizontal ellipsis = three dot leader … … …
prime = minutes = feet ′ ′ ′
double prime = seconds = inches ″ ″ ″
overline = spacing overscore ‾ ‾ ‾
fraction slash ⁄ ⁄ ⁄
script capital P = power set = Weierstrass p ℘ ℘ ℘
blackletter capital I = imaginary part ℑ ℑ ℑ
blackletter capital R = real part symbol ℜ ℜ ℜ
trade mark sign ™ ™ ™
alef symbol = first transfinite cardinal ℵ ℵ ℵ
leftwards arrow ← ← ←
upwards arrow ↑ ↑ ↑
rightwards arrow → → →
downwards arrow ↓ ↓ ↓
left right arrow ↔ ↔ ↔
downwards arrow with corner leftwards = carriage return ↵ ↵ ↵
leftwards double arrow ⇐ ⇐ ⇐
upwards double arrow ⇑ ⇑ ⇑
rightwards double arrow ⇒ ⇒ ⇒
downwards double arrow ⇓ ⇓ ⇓
left right double arrow ⇔ ⇔ ⇔
for all ∀ ∀ ∀
partial differential ∂ ∂ ∂
there exists ∃ ∃ ∃
empty set = null set = diameter ∅ ∅ ∅
nabla = backward difference ∇ ∇ ∇
element of ∈ ∈ ∈
not an element of ∉ ∉ ∉
contains as member ∋ ∋ ∋
n-ary product = product sign ∏ ∏ ∏
n-ary sumation ∑ ∑ ∑
minus sign − − −
asterisk operator ∗ ∗ ∗
square root = radical sign √ √ √
proportional to ∝ ∝ ∝
infinity ∞ ∞ ∞
angle ∠ ∠ ∠
logical and = wedge ∧ ∧ ∧
logical or = vee ∨ ∨ ∨
intersection = cap ∩ ∩ ∩
union = cup ∪ ∪ ∪
integral ∫ ∫ ∫
therefore ∴ ∴ ∴
tilde operator = varies with = similar to ∼ ∼ ∼
approximately equal to ≅ ≅ ≅
almost equal to = asymptotic to ≈ ≈ ≈
not equal to ≠ ≠ ≠
identical to ≡ ≡ ≡
less-than or equal to ≤ ≤ ≤
greater-than or equal to ≥ ≥ ≥
subset of ⊂ ⊂ ⊂
superset of ⊃ ⊃ ⊃
not a subset of ⊄ ⊄ ⊄
subset of or equal to ⊆ ⊆ ⊆
superset of or equal to ⊇ ⊇ ⊇
circled plus = direct sum ⊕ ⊕ ⊕
circled times = vector product ⊗ ⊗ ⊗
up tack = orthogonal to = perpendicular ⊥ ⊥ ⊥
dot operator ⋅ ⋅ ⋅
left ceiling = APL upstile ⌈ ⌈ ⌈
right ceiling ⌉ ⌉ ⌉
left floor = APL downstile ⌊ ⌊ ⌊
right floor ⌋ ⌋ ⌋
left-pointing angle bracket = bra ⟨ 〈 〈
right-pointing angle bracket = ket ⟩ 〉 〉
lozenge ◊ ◊ ◊
black spade suit ♠ ♠ ♠
black club suit = shamrock ♣ ♣ ♣
black heart suit = valentine ♥ ♥ ♥
black diamond suit ♦ ♦ ♦