WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Samples from Users
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

PcAnywhere Host Configs


Here is some sample code which will write out your pcAnywhere host session information.

We have pcAnywhere installed on over a hundred servers, and this utility helps us make sure the sessions are write.

I have only included the 'status' checks, but this could easily be converted to actually update the pcAnywhere host objects.

Here is the name of the OLE document from Symantec. Symantec pcAnywhere™ OLE Automation Guide

Barry

;---------------------------------------------------------------------------------------------------------------------------------
#DefineFunction pcAnywhereData(HostDataManager,BHFHostFile,OutputFileHandle)

   FileWrite(OutputFileHandle,StrCat('<b>',BHFHostFile,'</b>'))
   FileWrite(OutputFileHandle,'<TABLE BORDER CELLSPACING=1 CELLPADDING=7 WIDTH="100%%">')
   FileWrite(OutputFileHandle,'<tr>')
   FileWrite(OutputFileHandle,'<th width="20%%">Settings</th>')
   FileWrite(OutputFileHandle,'<th width="80%%">Description</th>')
   FileWrite(OutputFileHandle,"</tr>")

   HostData = HostDataManager.RetrieveObjectEx(BHFHostFile, 1, 0) ;1  Retrieve in view mode only
   ;Encryption Settings
   t1 = HostData.CryptReqLevel ;-1 = None, 0 = pcAnywhere, 1 = Symmetic, 2 = Public Key
   Select t1
      Case 0
         EncryptionLevel = "pcAnywhere"
         Break
      Case 1
         EncryptionLevel = "Symmetric"
         Break
      Case 2
         EncryptionLevel = "Public"
         Break
      Case t1
         EncryptionLevel = "None"
         Break
   EndSelect
   FileWrite(OutputFileHandle,StrCat("<tr><td>",EncryptionLevel,"</td><td>Encryption Settings</td></tr>"))

   ;Refuse Lower Encryption
   t1 = HostData.CryptRefuseLower ;0 will allow lower, -1 deny lower encryption
   If t1 == -1 Then
      msg = "Deny"
   Else
      msg = "Allow"
   End If
   FileWrite(OutputFileHandle,StrCat("<tr><td>",msg,"</td><td>Allow Users To Connect At A Lower Encryption Level</td></tr>"))

   ;User at the host computer must confirm they can be connected to
   msg = "False"
   t1 = HostData.ConfirmConnect ;0 will allow lower, -1 deny
   If t1 == -1 Then msg = "True"
   FileWrite(OutputFileHandle,StrCat("<tr><td>",msg,"</td><td>Host Must Confirm Connection</td></tr>"))

   If msg == "True" Then
      t1 = HostData.ConfirmTimeout ;timeout in seconds
      FileWrite(OutputFileHandle,StrCat("<tr><td>",t1,"</td><td>Seconds Host User Has To Allow The Connection</td></tr>"))

      ;User at the host computer must confirm they can be connected to
      msg = "False"
      t1 = HostData.ConfirmDeny ;0 will allow lower, -1 deny
      If t1 == -1 Then msg = "True"
      FileWrite(OutputFileHandle,StrCat("<tr><td>",msg,"</td><td>Disconnect If User Response Has Timed Out</td></tr>"))
   End If

   ;PW is case sensitive
   msg = "False"
   t1 = HostData.PwCaseSensitive ;0 false ; -1 true
   If t1 == -1 Then msg = "True"
   FileWrite(OutputFileHandle,StrCat("<tr><td>",msg,"</td><td>Password Is Case Sensitive</td></tr>"))

   ;Password Attempts
   t1 = HostData.PwAttempts ;attempts in seconds
   FileWrite(OutputFileHandle,StrCat("<tr><td>",t1,"</td><td>Maximum Password Attempts</td></tr>"))

   ;Password Timeout
   t1 = HostData.PwTimeout ;timeout in seconds
   FileWrite(OutputFileHandle,StrCat("<tr><td>",t1,"</td><td>Password Time Limit To Complete Login (In Minutes)</td></tr>"))

   ;Inactive Timeout
   t1 = HostData.InactiveTimeout ;timeout in seconds
   FileWrite(OutputFileHandle,StrCat("<tr><td>",t1,"</td><td>Numbers Of Minutes To Wait Befor Disconnecting If Inactive</td></tr>"))

   ;Lock System on host computer startup
   msg = "False"
   t1 = HostData.LockSystemWhileWait ;timeout in seconds
   If t1 == -1 Then msg = "True"
   FileWrite(OutputFileHandle,StrCat("<tr><td>",msg,"</td><td>Lock Host Computer Upon Startup</td></tr>"))

   ;Minimize on Launch
   msg = "False"
   t1 = HostData.MinimizeOnLaunch ;timeout in seconds
   If t1 == -1 Then msg = "True"
   FileWrite(OutputFileHandle,StrCat("<tr><td>",msg,"</td><td>Run Minimized On Host Startup</td></tr>"))

   ;Run as a service
   msg = "False"
   t1 = HostData.RunAsService ;timeout in seconds
   If t1 == -1 Then msg = "True"
   FileWrite(OutputFileHandle,StrCat("<tr><td>",msg,"</td><td>Run As A Service</td></tr>"))

   ;Inactive Timeout
   t1 = HostData.ConnLostWait
   FileWrite(OutputFileHandle,StrCat("<tr><td>",t1,"</td><td>Number Of Minutes To Wait Before Allowing Another Connection</td></tr>"))

   ;Run as a service
   msg = "Wait For Another Connection"
   t1 = HostData.ConnLostHostOpts ;timeout in seconds
   If t1 == -1 Then msg = "Cancel Host"
   FileWrite(OutputFileHandle,StrCat("<tr><td>",msg,"</td><td>Treatment If Host Session Ends Abnormally</td></tr>"))

   ;How do we authenticate the user
   t1 = HostData.AuthenticationType
   Select t1
      Case 2
         Msg = "Windows"
         Break
      Case 3
         Msg = "NT"
         Break
      Case 6
         Msg = "ADS Active Directory Services"
         Break
      Case 7
         Msg = "Microsoft LDAP"
         Break
      Case 8
         Msg = "FTP"
         Break
      Case 9
         Msg = "HTTP"
         Break
      Case 10
         Msg = "HTTPS"
         Break
      Case 11
         Msg = "Netscape LDAP"
         Break
      Case 12
         Msg = "Novell LDAP"
         Break
      Case 13
         Msg = "RSA SecurID"
         Break
      Case t1
         Msg = "pcAnywhere"
         Break
   EndSelect
   FileWrite(OutputFileHandle,StrCat("<tr><td>",Msg,"</td><td>How We Authenticate The User</td></tr>"))


   ;How do we after abnormal session end
;;FIND THIS!!
   msg = "Flag not found to give this answer!"
;   t1 = HostData.EndSessHostOpts ;timeout in seconds
;   if t1 == -1 then msg = "True"
   FileWrite(OutputFileHandle,StrCat("<tr><td>",msg,"</td><td>Abnormal Termination Security Option Is Enabled</td></tr>"))

   ;How do we after abnormal session end
   t1 = HostData.ConnLostSecurity
   Select t1
      Case 0
         Msg = "Log Off User"
         Break
      Case 1
         Msg = "Restart Host Computer"
         Break
      Case 2
         Msg = "Lock Computer"
         Break
      Case t1
         Msg = "Nothing"
         Break
   EndSelect
   FileWrite(OutputFileHandle,StrCat("<tr><td>",Msg,"</td><td>What Happens After An Abnormal Termination</td></tr>"))

   ;Normal Termination Security Option
   msg = "False"
   t1 = HostData.EnableEndSessSecurity
   If t1 == -1 Then msg = "True"
   FileWrite(OutputFileHandle,StrCat("<tr><td>",msg,"</td><td>Normal Termination Security Option Is Enabled</td></tr>"))

   If msg == "True" Then
      ;How do we after abnormal session end
      t1 = HostData.ConnLostSecurity
      Select t1
         Case 0
            Msg = "Log Off User"
            Break
         Case 1
            Msg = "Restart Host Computer"
            Break
         Case 2
            Msg = "Lock Computer"
            Break
         Case t1
            Msg = "Nothing"
            Break
      EndSelect
      FileWrite(OutputFileHandle,StrCat("<tr><td>",Msg,"</td><td>What Happens After A Normal Session End</td></tr>"))
   End If

   ;Will the host wait for another caller
   msg = "False"
   t1 = HostData.EndSessHostOpts ;timeout in seconds
   If t1 == -1 Then msg = "True"
   FileWrite(OutputFileHandle,StrCat("<tr><td>",msg,"</td><td>Host Will Be Cancelled After A Normal Host Session Ends</td></tr>"))

   ;Blank PC Screen
   msg = "False"
   t1 = HostData.EnableEndSessSecurity
   If t1 == -1 Then msg = "True"
   FileWrite(OutputFileHandle,StrCat("<tr><td>",msg,"</td><td>Blank PC Screen After Connection</td></tr>"))

   FileWrite(OutputFileHandle,"</table><br><br><hl><br>")

   Return


#EndFunction

OutputFileHandle = FileOpen("c:\temp\Host Config.html", "WRITE")
FileWrite(OutputFileHandle,StrCat("<HTML><HEAD><TITLE>pcAnywhere Host Configurations</TITLE></HEAD><BODY>"))


;Create CHostDataManager object
HostDataManager = CreateObject("WINAWSVR.BEHOSTDATAMANAGER")
t1 = BinaryAlloc(1024)
BinaryOleType(t1,202,0,0,0)

t2 = HostDataManager.FindFirst("*", t1)
BHFFile=BinaryPeekStr(t1,0,BinaryEodGet(t1))
pcAnywhereData(HostDataManager,BHFFile,OutputFileHandle)

While t2 <> 0
   t2 = HostDataManager.FindNext(t1)
   If t2 <> 0 Then
      BHFFile=BinaryPeekStr(t1,0,BinaryEodGet(t1))
      pcAnywhereData(HostDataManager,BHFFile,OutputFileHandle)
   End If
End While

FileWrite(OutputFileHandle,"</BODY></HTML>")

HostDataManager = ""
BinaryFree(t1)

FileClose(OutputFileHandle)

Article ID:   W17235
File Created: 2007:07:03:14:28:54
Last Updated: 2007:07:03:14:28:54