;; 
;;======================================================================----- 
;; 
;;FUNCTION       HostIsServer(), HostIsWkstn() 
;; 
;;ACTION         Returns a Boolean status for server or workstation tests 
;; 
;;AUTHOR         Glenn Barnas 
;; 
;;VERSION        1.0 - 2016/02/03 
;; 
;;HISTORY        1.0 - 2016/02/03 - Initial release 
;; 
;;SYNTAX         HostIsServer() or HostIsWkstn() 
;; 
;;PARAMETERS     None - operates on local system 
;; 
;;REMARKS        Used to control operations based on platform type 
;; 
;;RETURNS        Boolean - 1=True, 0=False 
;;               HostIsServer returns true on a server platform only 
;;               HostIsWkstn  returns true on a workstation platform only 
;; 
;;DEPENDENCIES   HostIsServer() is dependent on the HostIsWkstn() UDF - these are  
;;               co-resident in this UDF file. 
;; 
;;TESTED WITH    Servers:      W2K - W2K12r2 
;;               Workstations: WinXP - Win10 
;; 
;;EXAMPLES       If IsServer() 
;;                 ; run a server-only process... 
;;               EndIf 
;;               ; Prevent script from running on workstations 
;;               If IsWkstn() Exit 0 EndIf 
; 
Function HostIsWkstn()
 
  Dim $_PType
 
  $_PType = 1			; default to Is Workstation (true) 
 
  ; clear if current platform is a server 
  If InStr(@PRODUCTTYPE, 'Server') Or InStr(@PRODUCTTYPE, 'Controller')
    $_PType = 0
  EndIf
 
  $HostIsWkstn = $_PType
 
  Exit 0
 
EndFunction
 
 
Function HostIsServer()
 
  $HostIsServer = Not HostIsWkstn()
 
  Exit 0
 
EndFunction
 
 
Function HostClass()
 
  If HostIsWkstn()
    $HostClass = 'W'
  Else
    $HostClass = 'S'
  EndIf
  
  Exit 0
 
EndFunction