WinBatch® Technical Support Forum

All Things WinBatch => WinBatch => Topic started by: td on January 11, 2018, 09:50:58 AM

Title: **************** Network Extender version 34024 Released **********************
Post by: td on January 11, 2018, 09:50:58 AM
Version 39024 (NT extender only)  Jan 11, 2018 

        1. Added new login-type (parameter 3 value) to the wntRunAsUser function
           6 - New credentials login:  type 6 permits a script to impersonate
               a user on a remote system but use the existing access token on
               the local system.  This allows the Terminal Services Extender's
               wtsEnumSessions function to query remote systems for session
               information when the remote system and local system are not
               part a Windows Network domain or a similar trust relationship.

               This login-type may under certain conditions* help WIL remote
               registry functions and the Windows Network Extender's services
               related functions gain access to remote systems when a network
               trust relationship does not exist between the local and remote
               systems.
               
               This parameter can only be used on Vista/Windows 2008 and newer
               versions of the Windows Operating System.
               
               * Note that unlike the wtsEnumSession function, registry and
               service relate functions will use local system cached
               credentials for the remote system when present in the current
               local user's credentials store.


You need a current license to install this version.
Title: Re: ***************** Network Extender version 34024 **********************
Post by: td on January 11, 2018, 09:55:44 AM
Here is a revised version of the example script in the Terminal Services Extender help file that illustrates how to use the new  wntRunAsUser login-type with the wtsEnumSessions function:

Code (winbatch) Select
;Load 32-bit or 64-bit extender
AddExtender( "WWWNT34I.dll" , 0, "WWWNT64I.dll" )
AddExtender( "WWWTS44I.DLL" , 0, "WWWTS64I.DLL" )

Server  = '\\Whatever'
User    = 'guesswho'
Title01 = 'Test wtsEnumSessions()'

; Vista/2008 required.
Terminate(WinVersion(1) < 6, Title01, 'Windows Vista/2008 or newer required')

Pwd = '*topsecret*'
wntRunAsUser(Server, User, Pwd, 6, 0)
Pwd = ''
ErrorMode(@OFF)
Result = wtsEnumSessions(Server)
RC = LastError()
ErrorMode(@CANCEL)
wntRunAsUser( '', '', '', 0, 0)
TempMsg = StrCat('wtsEnumSessions() RC = ',RC,@CRLF)
If (RC == 0)
   TempMsg = StrCat(TempMsg,@CRLF,'Total # of Sessions = ',Result[0])
   TempMsg = StrCat(TempMsg,@CRLF,@CRLF,'Session #''s = "',StrReplace(Result[1],@TAB,', '),'"')
   TempMsg = StrCat(TempMsg,@CRLF,@CRLF,'Session Names = "',StrReplace(Result[2],@TAB,', '),'"')
   TempMsg = StrCat(TempMsg,@CRLF,@CRLF,'Connection Statuses = "',StrReplace(Result[3],@TAB,', '),'"')
EndIf
Message(Title01,TempMsg)
exit