I have now put the coding into my script. It no longer complains about a missing variable. But the output is not the output of the IP Address. I believe this is because I need the "delims=" and %%A, which I cannot get to work in Kixtart as it doesn't understand the command.

I think I will have to find another way to achieve this aim as the documentation on Ping and |find is pretty much non existent.

 Code:

;=================================================================
;  Shutdown Computers
;=================================================================

Dim $objAdsPath, $obj, $filter[0]
$filter[0] = "computer"
$objADsPath = GetObject("LDAP://OU=Accounting,OU=Computers,DC=%Userdomain%,DC=internal")

If @Error = 0

	$objAdsPath.filter = $filter
	For Each $obj In $objAdsPath
		$PcName = SUBSTR($obj.name, 4)
		? $PcName
;		Shell '"'+%COMSPEC%+'" /c ping -n 1 ' + $PcName + ' |find /C "TTL=" >nul'
		Shell '"'+%COMSPEC%+'" /c ping -n 1 ' + $PcName + ' |find /C  "[=" $IP'
		? $IP
		$OSPing = NOT @ERROR	
		? $OSPing
		If $OSPing = 1
			$ShellCMD = 'shutdown -s -f -m ' + $PcName + ' -t 300'
			Shell $ShellCMD
			? "shutting down " + $PcName
		Else
			? "computer not online"
		Endif
	Next

Else
	? "Not able to connect to LDAP path."
Endif