logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
Steven  
#1 Posted : Wednesday, April 6, 2016 11:01:44 PM(UTC)
Steven


Rank: Administration

Medals: Level 1: Random Act of Kindness! Received One Thanks!

Joined: 5/1/2015(UTC)
Posts: 53
United States
Location: Tampa, FL

Was thanked: 12 time(s) in 8 post(s)
A new extension was submitted for those situations where you need to update the ScreenConnect server with a variable or information that can be stored in a variable from the remote machine. When first building the access installer, it is possible to do so using a variable within the Access Installer Builder's fields, which will work for Windows Vista and newer OSes, and Windows XP if you side-load SETX. However, this information will not be updated on the server after the initial check-in by the client, and cannot be obtained thereafter if it wasn't set in a variable at the time of installation.

To work around these, I wrote an extension that uses the commands feature to gather the variables from the remote machine, and allow them to be saved into the Session Name, or any of the 8 Custom Properties. For more information on editing session details manually and enabling custom fields/properties for sessions on our Help Site.

To install the extension, use the Online Extension Browser to find and install the "Set Session Properties From System Variables" extension and install it. Note: At the time this is written, it has been submitted for publication, but is not yet published.

Once installed, you should see this on your Admin/Extensions Tab:
UserPostedImage

By default, the extension has no settings defined. You will need to define at least one session variable name to use for the extension to work. There are three ways to access the Extension Settings. The first is through the Options > Edit Settings menu on the extension on the Extensions Tab:
UserPostedImage

If logged in as an Administrator, it can also be accessed from the Host page by Selecting the "Update Properties from Variables" option when right-clicking a session, or from the More menu when no settings are defined. If the settings are defined, this instead will run the extension. This is useful so attempting to run it without settings in place, it will prompt you to provide them. You can also right click the "Update Properties from Variables" link in the context menu or under "More..." to bring up the Edit Extension Settings menu at any time.
UserPostedImage

If a non-administrator attempts to run this while it is not setup, they will get prompted to contact their ScreenConnect Administrator for assistance:
UserPostedImage

Once the settings menu is open, you can provide a variable name in "SessionNameVariableName" or any of the 8 "CustomProperty#VariableName" Keys and that will be the environment variable used to populate the session.
UserPostedImage


It will use the same variable names for Windows, Mac, Linux and Android devices, so please pick them carefully. Also, do not use any formatting on the variable names to identify them as variables in most cases, so no need to encapsulate the name with percent signs for windows or prefix them with dollar signs for Mac/Linux/Powershell. For example, if you wanted to get the 'computername' variable, you would simply enter "computername" in the desired field.
UserPostedImage

To help facilitate differences between operating systems, and to allow setting variables on the fly when this extension is run, you can also specify the Command Interpreter, a "Pre" command, which is run before the variable values are pulled, and a "Post" command, which will be run thereafter in case any clean up is necessary. The Extension Settings editor for this extension has been modified to allow Text Area type fields for these command entries to facilitate multi-line commands (script-style).
UserPostedImage

Once the "Update Properties from Variables" command is selected for one or more sessions, it will send a command to those remote machines. This will happen in the logged on user's context, so be sure they have the "RunCommandOutsideSession" permission to be able to run this. If they do not have this permission, the option will be grayed out.
UserPostedImage

Also note, the default permissions for the "Host" role does not include the option to Run Commands Outside Session for access sessions (requires "OwnedAndUnowned" to work with Access Sessions).

The command and response, for the "computername" would send and recieve commands that look like this:
UserPostedImage

In another example, I set the following:
SessionnameVariableName: computername
CustomProperty1VariableName: scvar1
CustomProperty2VariableName: scvar2
CustomProperty3VariableName: novalue
WindowsCommandInterpreter: ps
UseEnvironmentVariablesInPowershell: false
WindowsPreCommand:
Code:
$computername=$env:computername
$scvar1 = "Hello World"
$scvar2 = (wmic path win32_videocontroller get name)


It sent the following:
UserPostedImage

And this was the return:
UserPostedImage

Resulting in a Session with the following info (Organization = CustomProperty1, Words = CustomProperty2):
UserPostedImage

A few notes with this, I set the "ps" for the interpreter to use Powershell on Windows. Next I set the "UseEnvironmentVariablesInPowershell" to false, otherwise each variable would have been prefixed with a "env:" which pulls environment variables, as opposed to temporary variables for the session. I did so because I wanted to use other variables on the session that were not environment variables.

I also set the code in the WindowsPreCommand to set the variables as needed, loading the comptuername environment variable into the computername local PS variable, set scvar1 to a set string, and scvar2 to the output of a command. Note that the command, if run directly, provides multi-line output, but in this case, since it is going into a variable, only provides a single line - necessary for this extension to work. If the number of lines of output does not meet the number of variables it expects to write, the session properties will not be updated, but the name will have an error message appended to it to let you know the command didn't complete successfully.

Note that for the third CustomProperty I set it to a variable that does not have a value set, this will clear out the CustomProperty on the server, which before this was run set to "Testing". If you do not specify a variable name in the settings for the SessionName or any of the Custom Properties, it will note update or clear them out, leaving them as they exist before the command is run.
ScreenConnect Team
Steven  
#2 Posted : Wednesday, April 6, 2016 11:20:49 PM(UTC)
Steven


Rank: Administration

Medals: Level 1: Random Act of Kindness! Received One Thanks!

Joined: 5/1/2015(UTC)
Posts: 53
United States
Location: Tampa, FL

Was thanked: 12 time(s) in 8 post(s)
Some useful commands

set "computername" variable to the various computer names available on a mac:

Code:
computername=$(scutil --get HostName)
computername=$(scutil --get ComputerName)
computername=$(scutil --get LocalHostName)


* Note that all three of those can return different values.
basically here we have the variablename without any $ before hand, set with just an = sign, and then the command wrapped in parentheses and prefixed with a dollar sign ($) to get the results of the command, instead of the command itself.

On linux you could use:

Code:
computername=$(hostname)


Same general concept. Note that for both Mac and Linux listed, this will set it locally for the script running only, and will not set it globally, so they will not persist. To do this with Windows, if using "cmd" ensure you use 'setlocal' in your WindowsPreCommand. For powershell, set UseEnvironmentVariablesInPowershell to false, and use a $ prefix for the variable name on the left of the equation. For example use "$env:" to access environment variables that are available to the command line, like %computername%, %path%, %appdata%, etc.
Powershell Example
Code:
$computername=$env:computername


Note that if you leave "UseEnvironmentVariablesInPowershell" as the default "true", the code will use "echo $env:{0}" and if set to false, will use "echo ${0}" to obtain the variable values when "ps" is defined as the WindowsCommandInterpreter, where {0} is replaced with the variable name by the extension setting value.
ScreenConnect Team
krutz  
#3 Posted : Tuesday, August 23, 2016 1:13:48 AM(UTC)
krutz


Rank: Newbie

Joined: 12/30/2015(UTC)
Posts: 17
United States
Location: Omaha

Thanks: 1 times
I am using this extension to some success.

I have the extension setup like above.

$scvar8 = (sc.exe query "LTService" | findstr "SERVICE_NAME")

It says write host in the guest response and has the correct data but it does not show up under the custom property for all my machines.
It works for ~900 machines, I can't figure out why it wouldn't fill in the custom property if the response is coming back correct.

From host:

#!ps
#maxlength=10000
#timeout=30000
$scvar8 = (sc.exe query "LTService" | findstr "SERVICE_NAME")
echo "Update Session With Following Information (called from Extension ID: 2cd2cf2a-5ac5-4dbc-954c-c8b31e0aa906)"
write-host $scvar8
echo "Update Session With Preceeding Information (called from Extension ID: 2cd2cf2a-5ac5-4dbc-954c-c8b31e0aa906)"


Guest response:

Update Session With Following Information (called from Extension ID: 2cd2cf2a-5
ac5-4dbc-954c-c8b31e0aa906)
SERVICE_NAME: LTService
Update Session With Preceeding Information (called from Extension ID: 2cd2cf2a-
5ac5-4dbc-954c-c8b31e0aa906)
hlkj112  
#4 Posted : Tuesday, August 23, 2016 3:22:33 PM(UTC)
hlkj112


Rank: Newbie

Joined: 2/9/2015(UTC)
Posts: 1
United States

Does this extension work with 6.0? I am trying something very similar to the examples, but the extension doesn't seem to actually "run". My settings are:

CustomProperty6VariableName: scvar6
WindowsCommandInterpreter: ps
UseEnvironmentVariablesInPowershell: false
WindowsPreCommand: $scvar6 = (wmic bios get serialnumber)

I'm signed as the default administrator role, and all my systems are set up as unattended access. When I right click a system and choose "Update Properties from Variables", nothing happens.
krutz  
#5 Posted : Friday, August 26, 2016 4:30:31 AM(UTC)
krutz


Rank: Newbie

Joined: 12/30/2015(UTC)
Posts: 17
United States
Location: Omaha

Thanks: 1 times
Doesn't seem to work in 6 had it working and just upgraded to 6 and now it wont run the commands.
Steven  
#6 Posted : Tuesday, August 30, 2016 7:09:14 PM(UTC)
Steven


Rank: Administration

Medals: Level 1: Random Act of Kindness! Received One Thanks!

Joined: 5/1/2015(UTC)
Posts: 53
United States
Location: Tampa, FL

Was thanked: 12 time(s) in 8 post(s)
I've identified the issue and am looking to see if it's a problem with my code, or with a change to the product that I need to work around. I'll update the forum soon with an update.

Also, while I'm on here, here is a good one to have as a pre-run script for to get the relay of the remote machine in a custom property for Windows using powershell (set varname for desired prop to SCRelay)

$SCRelay = $null
(reg query "HKLM\SYSTEM\CurrentControlSet\Services\ScreenConnect Client (xxxxxxxxxxxxxxxx)" -v ImagePath).split('&') | foreach {if ($_.StartsWith("h=") -Or $_.StartsWith("p=")) {$SCRelay += $_ + " "}}


will be in format:

h=RELAYHOST p=RELAYPORT

Good for confirming changing the relay has worked.
ScreenConnect Team
dbuerger  
#7 Posted : Monday, October 24, 2016 4:55:42 PM(UTC)
dbuerger


Rank: Guest

Joined: 10/24/2016(UTC)
Posts: 2
United States
Location: PA

Steven, has there been any update on this? Seems to work sometimes, but not always. I can't quite figure out why for some computers and why not for others.
techpatriot  
#8 Posted : Tuesday, November 1, 2016 6:50:49 PM(UTC)
techpatriot


Rank: Newbie

Medals: Level 1: Random Act of Kindness! Received One Thanks!

Joined: 5/20/2015(UTC)
Posts: 8
United States

Was thanked: 2 time(s) in 2 post(s)
The extension is working fine for me on build 6.0.11622.6115 using the sample code in the first post. The name of the display driver appears as expected. BigGrin

However, I'm trying to retrieve a "last logged on display name" value, but my code isn't returning any results through ScreenConnect. Here is the code that works natively in PowerShell and simply returns a display name:

(Get-ItemProperty -Path "Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI").Lastloggedondisplayname

Here are my settings in ScreenConnect.

Appearance \ Web Resources Settings:
SessionProperty.Custom3.AccessVisible -> true
SessionProperty.Custom3.LabelText -> Display Name:

Extension Settings:
CustomProperty3VariableName -> DisplayName
WindowsCommandInterpreter -> ps
UseEnvironmentVariablesInPowershell -> false
WindowsPreCommand -> $DisplayName = ((Get-ItemProperty -Path "Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI").Lastloggedondisplayname)


But, it doesn't return any value unfortunately...

Host Submission:

#!ps
#maxlength=10000
#timeout=30000
$DisplayName = ((Get-ItemProperty -Path "Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI").Lastloggedondisplayname)
echo "Update Session With Following Information (called from Extension ID: 2cd2cf2a-5ac5-4dbc-954c-c8b31e0aa906)"
write-host $DisplayName
echo "Update Session With Preceeding Information (called from Extension ID: 2cd2cf2a-5ac5-4dbc-954c-c8b31e0aa906)"


Guest Response:

Update Session With Following Information (called from Extension ID: 2cd2cf2a-5ac5-4dbc-954c-c8b31e0aa906)

Update Session With Preceeding Information (called from Extension ID: 2cd2cf2a-5ac5-4dbc-954c-c8b31e0aa906)


If I don't encapsulate the command with extra parenthesis like this...

$DisplayName = (Get-ItemProperty -Path "Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI").Lastloggedondisplayname

...it still doesn't return any value.


Host Submission:

#!ps
#maxlength=10000
#timeout=30000
$DisplayName = (Get-ItemProperty -Path "Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI").Lastloggedondisplayname
echo "Update Session With Following Information (called from Extension ID: 2cd2cf2a-5ac5-4dbc-954c-c8b31e0aa906)"
write-host $DisplayName
echo "Update Session With Preceeding Information (called from Extension ID: 2cd2cf2a-5ac5-4dbc-954c-c8b31e0aa906)"


Guest Response:

Update Session With Following Information (called from Extension ID: 2cd2cf2a-5ac5-4dbc-954c-c8b31e0aa906)

Update Session With Preceeding Information (called from Extension ID: 2cd2cf2a-5ac5-4dbc-954c-c8b31e0aa906)



I have 4 other methods to return a display name as well, but I've not had success running them through the ScreenConnect command prompt either. They work just fine directly on the machine:

POWERSHELL

$dom = $env:userdomain
$usr = $env:username
([adsi]"WinNT://$dom/$usr,user").fullname


POWERSHELL

Add-Type -AssemblyName System.DirectoryServices.AccountManagement;
$DisplayName = [System.DirectoryServices.AccountManagement.UserPrincipal]::Current.DisplayName;
$DisplayName


CMD

for /f "tokens=2*" %n in ('net user "%USERNAME%" /domain^|FINDSTR /C:"Full Name"') do echo %o


CMD and POWERSHELL

REG QUERY "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI" /v Lastloggedondisplayname

Do I need to encapsulate the WindowsPreCommand differently maybe?
Matt Highsmith  
#9 Posted : Wednesday, November 2, 2016 12:27:47 PM(UTC)
Matt Highsmith


Rank: Advanced Member

Medals: ScreenConnect Advisor: Focus Group MemberLevel 2: Lent a Helping Hand! 10 Thanks!

Joined: 4/1/2014(UTC)
Posts: 224
United States
Location: Raleigh

Thanks: 2 times
Was thanked: 15 time(s) in 11 post(s)
it appears that the PS part is working, but the process is not populating the fields when completed. using 6.0
Steven  
#10 Posted : Wednesday, November 2, 2016 1:03:13 PM(UTC)
Steven


Rank: Administration

Medals: Level 1: Random Act of Kindness! Received One Thanks!

Joined: 5/1/2015(UTC)
Posts: 53
United States
Location: Tampa, FL

Was thanked: 12 time(s) in 8 post(s)
Hi Matt,

Thanks for using my extension. First, make sure you're using the latest version of the extension (1.1.1). If that doesn't help, let me know the browser you're using when it's not working, and both the sent and received commands when running the extension, and I'll be happy to take a look into it.
ScreenConnect Team
Matt Highsmith  
#11 Posted : Wednesday, November 2, 2016 1:23:47 PM(UTC)
Matt Highsmith


Rank: Advanced Member

Medals: ScreenConnect Advisor: Focus Group MemberLevel 2: Lent a Helping Hand! 10 Thanks!

Joined: 4/1/2014(UTC)
Posts: 224
United States
Location: Raleigh

Thanks: 2 times
Was thanked: 15 time(s) in 11 post(s)
Steven,

I am using Chrome version
Version 55.0.2883.9 dev (64-bit)

Sent Command:

#!ps
#maxlength=10000
#timeout=30000
$scvar8 = (wmic computersystem get model)
echo "Update Session With Following Information (called from Extension ID: 2cd2cf2a-5ac5-4dbc-954c-c8b31e0aa906)"
write-host $scvar8
echo "Update Session With Preceeding Information (called from Extension ID: 2cd2cf2a-5ac5-4dbc-954c-c8b31e0aa906)"

Received information:

Update Session With Following Information (called from Extension ID: 2cd2cf2a-5
ac5-4dbc-954c-c8b31e0aa906)
Model OptiPlex 3010
Update Session With Preceeding Information (called from Extension ID: 2cd2cf2a-
5ac5-4dbc-954c-c8b31e0aa906)
Steven  
#12 Posted : Wednesday, November 2, 2016 1:24:20 PM(UTC)
Steven


Rank: Administration

Medals: Level 1: Random Act of Kindness! Received One Thanks!

Joined: 5/1/2015(UTC)
Posts: 53
United States
Location: Tampa, FL

Was thanked: 12 time(s) in 8 post(s)
techpatriot,

Thanks for using my extension.

A place to start with troubleshooting those commands is to just run them in the commands tab alone and see what they return.

Example:

#!ps
Get-ItemProperty -Path "REGISTRY::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI"

this command run alone will return all the available properties of that path. When I do this through ScreenConnect, I don't see the Lastloggedondisplayname, or even the Lastloggedonusername that I see when I run the command locally on my machine. The reason is most likely that we're running that powershell prompt as the Local System account on the machine, which might pull different information.

You'll also get a different value than you might expect from getting the username from the remote machine, that should always return the computer name followed by a $, as that is the username of the local system account.

If you're looking to get the username/etc of the actual logged on user, you'll have to work about it from a different angle, such as using WMI:

#!ps
(Get-WmiObject win32_computersystem).username

Best regards!
ScreenConnect Team
Matt Highsmith  
#13 Posted : Wednesday, November 2, 2016 1:31:44 PM(UTC)
Matt Highsmith


Rank: Advanced Member

Medals: ScreenConnect Advisor: Focus Group MemberLevel 2: Lent a Helping Hand! 10 Thanks!

Joined: 4/1/2014(UTC)
Posts: 224
United States
Location: Raleigh

Thanks: 2 times
Was thanked: 15 time(s) in 11 post(s)
ok - so i am trying to get the machine model so that i can filter by machine. this is the command

%scvar8% = (wmic computersystem get model)


this pulls back.

C:\Windows\system32>(wmic computersystem get model )
Model

OptiPlex 3010


but nothing shows up in the field.

Edited by user Wednesday, November 2, 2016 1:54:55 PM(UTC)  | Reason: Not specified

techpatriot  
#14 Posted : Wednesday, November 2, 2016 3:23:38 PM(UTC)
techpatriot


Rank: Newbie

Medals: Level 1: Random Act of Kindness! Received One Thanks!

Joined: 5/20/2015(UTC)
Posts: 8
United States

Was thanked: 2 time(s) in 2 post(s)
Hi Matt,

What is the name of the entry that you put in the CustomPropertyVariableName for the extension settings? (for example in CustomProperty1VariableName, CustomProperty2VariableName, etc.)

Make sure you do NOT have any $ or % symbols in the entry. Only call out the name of your variable. It should say scvar8 only, for your code.

Just a thought...

Thanks,
John
Matt Highsmith  
#15 Posted : Wednesday, November 2, 2016 3:35:43 PM(UTC)
Matt Highsmith


Rank: Advanced Member

Medals: ScreenConnect Advisor: Focus Group MemberLevel 2: Lent a Helping Hand! 10 Thanks!

Joined: 4/1/2014(UTC)
Posts: 224
United States
Location: Raleigh

Thanks: 2 times
Was thanked: 15 time(s) in 11 post(s)
the variable is scvar8 without any symbols. Actually when i put a symbol in there it did update the computer name interestingly. I have also changed the variable to model with $model in the ps command.
Matt Highsmith  
#16 Posted : Wednesday, November 16, 2016 1:35:10 PM(UTC)
Matt Highsmith


Rank: Advanced Member

Medals: ScreenConnect Advisor: Focus Group MemberLevel 2: Lent a Helping Hand! 10 Thanks!

Joined: 4/1/2014(UTC)
Posts: 224
United States
Location: Raleigh

Thanks: 2 times
Was thanked: 15 time(s) in 11 post(s)
I have verified that this extension is not working with 6.0 or with 6.1. I have installed the latest version of the extension. Using Chrome and IE from multiple PCs.
techpatriot  
#17 Posted : Thursday, November 17, 2016 8:57:21 PM(UTC)
techpatriot


Rank: Newbie

Medals: Level 1: Random Act of Kindness! Received One Thanks!

Joined: 5/20/2015(UTC)
Posts: 8
United States

Was thanked: 2 time(s) in 2 post(s)
I came up with a working solution for my desired goal of showing the user display name as a custom property. It is a two-part solution.

First I added the following code to my user login script. It creates a 'dat' with the current logged in user display name and the file gets overwritten with each login. I chose C:\ProgramData to write the file to as it seems to be one of the few "non protected" default folders in Windows 10. Works in Windows 7 and 8 too.


' Write user display name to local file for ScreenConnect
On Error Resume Next
Dim objUser, CurrentUser, datFile, dat
Set objUser = CreateObject("ADSystemInfo")
Set CurrentUser = GetObject("LDAP://" & objUser.UserName)
Set datFile = WScript.CreateObject("Scripting.Filesystemobject")
Set dat = datFile.CreateTextFile("C:\ProgramData\dat", 2)
dat.WriteLine CurrentUser.displayName
dat.Close


Second, I configured ScreenConnect with the following settings.


Appearance \ Web Resources Settings:

SessionProperty.Custom4.AccessVisible -> true
SessionProperty.Custom4.LabelText -> User Display Name:


Extension Settings:

CustomProperty4VariableName -> DisplayName
WindowsCommandInterpreter -> ps
UseEnvironmentVariablesInPowershell -> false
WindowsPreCommand -> $DisplayName = type C:\ProgramData\dat


And then everything seems to work well. Thanks for the extension!

Edited by user Thursday, November 17, 2016 9:04:17 PM(UTC)  | Reason: Not specified

Steven  
#18 Posted : Friday, November 18, 2016 8:48:41 PM(UTC)
Steven


Rank: Administration

Medals: Level 1: Random Act of Kindness! Received One Thanks!

Joined: 5/1/2015(UTC)
Posts: 53
United States
Location: Tampa, FL

Was thanked: 12 time(s) in 8 post(s)
Matt, thanks for your resposne. The latest version (1.1.1) does work with 6.0 (I've not tested with 6.1 yet). It may be that you're testing with powershell commands on a Windows 10 Anniversary Update (10.0.14xxx+)? That version of Windows currently doesn't work with our method of running powershell commands (we get an empty response back). You can see this if you try to do something like:

#!ps
write-host "Hello World"

in the commands tab, you'll notice you get a resposne, but it's empty. If this is the case, you should be able to use it with "cmd" for the interpreter, but I'll admit that can be more limiting. Hopefully we can get a fix in (or Microsoft does) for that issue soon.

You might be able to get what you need with powershell -command "command goes here", however?

If this isn't the case, please let me know an example of what you're sending and receiving as seen in the cmd tab.

Thanks for using my extension :)

Edited by user Friday, November 18, 2016 8:52:23 PM(UTC)  | Reason: Not specified

ScreenConnect Team
Matt Highsmith  
#19 Posted : Friday, November 18, 2016 8:56:26 PM(UTC)
Matt Highsmith


Rank: Advanced Member

Medals: ScreenConnect Advisor: Focus Group MemberLevel 2: Lent a Helping Hand! 10 Thanks!

Joined: 4/1/2014(UTC)
Posts: 224
United States
Location: Raleigh

Thanks: 2 times
Was thanked: 15 time(s) in 11 post(s)
Steven

using Windows 7 currently on both machines.

results from the command tab

#!ps
#maxlength=10000
#timeout=30000
$model = (wmic COMPUTERSYSTEM GET MODEL)
echo "Update Session With Following Information (called from Extension ID: 2cd2cf2a-5ac5-4dbc-954c-c8b31e0aa906)"
write-host $model
echo "Update Session With Preceeding Information (called from Extension ID: 2cd2cf2a-5ac5-4dbc-954c-c8b31e0aa906)"

response from Guest
[X]Guest11-18 15:51:50
Update Session With Following Information (called from Extension ID: 2cd2cf2a-5
ac5-4dbc-954c-c8b31e0aa906)
Model OptiPlex 3010
Update Session With Preceeding Information (called from Extension ID: 2cd2cf2a-
5ac5-4dbc-954c-c8b31e0aa906)


so you see that Model Optiplex 3010 comes back. Unfortunately it does not update CustomProperty8VariableName

the variable for 8 = model

WindowsCommandInterpreter =ps

UseEnvironmentVariablesInPowershell = false

WindowsPreCommand = $model = (wmic COMPUTERSYSTEM GET MODEL)


everything is working except that it is not updating the field.
Kostya  
#20 Posted : Friday, December 2, 2016 4:30:10 AM(UTC)
Kostya


Rank: Newbie

Joined: 10/15/2015(UTC)
Posts: 3
Singapore

Thanks: 2 times
Was thanked: 1 time(s) in 1 post(s)
Hi Steven,
I'm using your extension (1.1.1) on self-hosted Screenconnect 6.0.11299.6071 and facing the same issues as Matt mentioned.
I got some time to dig in, please find my report below

1. Variable got successfully transferred but Session (CustomProperty) never got updated if Guest running Windows 7.
Using PS interpreter and simple $var="test" I got CustomProperty updated only for few sessions. The only thing I found in common - guest OS version

Windows 10 Home (10.0.14393) - updated
Windows 8.1 (6.3.9600) - updated
Windows Server 2012 Standard (6.2.9200) - updated
Windows Server 2012 R2 Standard (6.3.9600) - updated
Windows 7 Ultimate (6.1.7601) - NOT UPDATED
Windows Embedded Standard (6.1.7601) - NOT UPDATED

If you can give me some hints where to add some browser console logging I can clone your extension and test it again capturing logs.

2. PS commands are definitely broken on Win 10 10.0.14393. But not all of them. Some simple commands ("Hello World") are running successfully. Proof below.
Run remote ps on win 10.0.14393
Matt Highsmith  
#21 Posted : Friday, December 2, 2016 1:42:42 PM(UTC)
Matt Highsmith


Rank: Advanced Member

Medals: ScreenConnect Advisor: Focus Group MemberLevel 2: Lent a Helping Hand! 10 Thanks!

Joined: 4/1/2014(UTC)
Posts: 224
United States
Location: Raleigh

Thanks: 2 times
Was thanked: 15 time(s) in 11 post(s)
Thanks Kostya, you are correct it does work on windows 10. the issue is with windows 7 apparently. which unfortunately most of our devices.
Matt Highsmith  
#22 Posted : Monday, December 12, 2016 8:40:56 PM(UTC)
Matt Highsmith


Rank: Advanced Member

Medals: ScreenConnect Advisor: Focus Group MemberLevel 2: Lent a Helping Hand! 10 Thanks!

Joined: 4/1/2014(UTC)
Posts: 224
United States
Location: Raleigh

Thanks: 2 times
Was thanked: 15 time(s) in 11 post(s)
So the reason why the extension does not work on Windows 7 is because the Extension ID information is not put on one line:

Example of Windows 10 - Works:

Update Session With Following Information (called from Extension ID: 2cd2cf2a-5ac5-4dbc-954c-c8b31e0aa906)
Model HP EliteOne 800 G1 AiO
Update Session With Preceeding Information (called from Extension ID: 2cd2cf2a-5ac5-4dbc-954c-c8b31e0aa906)


Example of Windows 7 - Broken:

Update Session With Following Information (called from Extension ID: 2cd2cf2a-5
ac5-4dbc-954c-c8b31e0aa906)
Model OptiPlex 3040
Update Session With Preceeding Information (called from Extension ID: 2cd2cf2a-
5ac5-4dbc-954c-c8b31e0aa906)


as you can see the Extension ID is split into 2 lines. I am not sure what to look for in the code to resolve this though.
Kostya  
#23 Posted : Tuesday, December 13, 2016 6:02:54 AM(UTC)
Kostya


Rank: Newbie

Joined: 10/15/2015(UTC)
Posts: 3
Singapore

Thanks: 2 times
Was thanked: 1 time(s) in 1 post(s)
Good catch Matt!

Yeah, that's the reason. Extension parsed response from Guest string by string.
Where first string is "Update Session With Following Information (called from Extension ID: extensionId)"
Last string: "Update Session With Preceeding Information (called from Extension ID: extensionId)"
All strings between those lines - custom variables.

Powershell 2.0 breaking this by insert CR after each 80 chars in the string. So response not parsed correctly.

Possible workarounds:
1. Update Guest machine to Powershell 4.0 (here).
2. Update extencion to shorten first and last string to something like "Start: extensionId" and "End: extensionId", so it won't exceed 80 chars and would be parsed correctly once returned by any Windows machine.

Let's wait for Steven and see if he's willing to fix this.

thanks 1 user thanked Kostya for this useful post.
JoeW on 5/29/2017(UTC)
Kostya  
#24 Posted : Tuesday, December 13, 2016 6:10:25 AM(UTC)
Kostya


Rank: Newbie

Joined: 10/15/2015(UTC)
Posts: 3
Singapore

Thanks: 2 times
Was thanked: 1 time(s) in 1 post(s)
If you wish to test it by yourself below are snippets of code to replace in original code.

Initializer.js
Code:
var command = (useSheBang ? "#!" + commandInterpreter + "\n" : "") +
		"#maxlength=" + extensionContext.settingValues.CommandReturnMaxLengthInCharacters + "\n" +
		"#timeout=" + extensionContext.settingValues.CommandReturnTimeoutInMilliseconds + "\n" +
		(commandInterpreter.toLowerCase() == "cmd" ? "@echo off\n" : "") +
		PreCommand + "\n" +
		//SC.util.formatString(echo,SC.util.formatString(SC.res["Extension.SetSessionPropertiesFromSystemVariables.CommandStartIDTextFormat"],extensionId)) + "\n" +
		SC.util.formatString(echo,SC.util.formatString("Start:" + extensionId)) + "\n" +
		(extensionContext.settingValues.SessionNameVariableName === '' ? '' : SC.util.formatString(echoVar,extensionContext.settingValues.SessionNameVariableName,env) + "\n") +
		(extensionContext.settingValues.CustomProperty1VariableName === '' ? '' : SC.util.formatString(echoVar,extensionContext.settingValues.CustomProperty1VariableName,env) + "\n") +
		(extensionContext.settingValues.CustomProperty2VariableName === '' ? '' : SC.util.formatString(echoVar,extensionContext.settingValues.CustomProperty2VariableName,env) + "\n") +
		(extensionContext.settingValues.CustomProperty3VariableName === '' ? '' : SC.util.formatString(echoVar,extensionContext.settingValues.CustomProperty3VariableName,env) + "\n") +
		(extensionContext.settingValues.CustomProperty4VariableName === '' ? '' : SC.util.formatString(echoVar,extensionContext.settingValues.CustomProperty4VariableName,env) + "\n") +
		(extensionContext.settingValues.CustomProperty5VariableName === '' ? '' : SC.util.formatString(echoVar,extensionContext.settingValues.CustomProperty5VariableName,env) + "\n") +
		(extensionContext.settingValues.CustomProperty6VariableName === '' ? '' : SC.util.formatString(echoVar,extensionContext.settingValues.CustomProperty6VariableName,env) + "\n") +
		(extensionContext.settingValues.CustomProperty7VariableName === '' ? '' : SC.util.formatString(echoVar,extensionContext.settingValues.CustomProperty7VariableName,env) + "\n") +
		(extensionContext.settingValues.CustomProperty8VariableName === '' ? '' : SC.util.formatString(echoVar,extensionContext.settingValues.CustomProperty8VariableName,env) + "\n") +
		//SC.util.formatString(echo,SC.util.formatString(SC.res["Extension.SetSessionPropertiesFromSystemVariables.CommandEndIDTextFormat"],extensionId)) + "\n" +
		SC.util.formatString(echo,SC.util.formatString("End:" + extensionId)) + "\n" +
		PostCommand;


SessionEventTrigger.cs
Code:
List<string> dataList = sete.SessionEvent.Data.Replace("ECHO is off.","").Split(new string[] { "\r\n", "\n" }, StringSplitOptions.None).ToList();
//int offset = dataList.FindIndex(s => s == String.Format(WebResources.GetString("Extension.SetSessionPropertiesFromSystemVariables.CommandStartIDTextFormat"),ExtensionContext.Current.ExtensionID.ToString()));
int offset = dataList.FindIndex(s => s == String.Format("Start:" + ExtensionContext.Current.ExtensionID.ToString()));
//int endIndex = dataList.FindIndex(s => s == String.Format(WebResources.GetString("Extension.SetSessionPropertiesFromSystemVariables.CommandEndIDTextFormat"),ExtensionContext.Current.ExtensionID.ToString()));
int endIndex = dataList.FindIndex(s => s == String.Format("End:" + ExtensionContext.Current.ExtensionID.ToString()));

Edited by user Tuesday, December 13, 2016 8:14:42 AM(UTC)  | Reason: Not specified

Steven  
#25 Posted : Tuesday, December 13, 2016 7:40:43 PM(UTC)
Steven


Rank: Administration

Medals: Level 1: Random Act of Kindness! Received One Thanks!

Joined: 5/1/2015(UTC)
Posts: 53
United States
Location: Tampa, FL

Was thanked: 12 time(s) in 8 post(s)
I'm actually not able to reproduce on my Windows 7 machine, but it's an easy enough fix. I've updated the strings to be shorter and published a new version (1.1.2). Once it's approved, these settings will be less than 80 characters with the session ID included.

In the meantime, you can manually edit those strings can be edited on the Admin > Appearance page in these two Web Resources:
Extension.SetSessionPropertiesFromSystemVariables.CommandStartIDTextFormat
Extension.SetSessionPropertiesFromSystemVariables.CommandEndIDTextFormat

{0} in those will be replaced with the extension's ID (this allows cloning the extension and them not running into issues with each other).



Here is what I'll be using in 1.1.2:

Extension.SetSessionPropertiesFromSystemVariables.CommandStartIDTextFormat: Update session with the following (Ext:{0})
Extension.SetSessionPropertiesFromSystemVariables.CommandEndIDTextFormat: Update session with preceeding information.


Really only the first of those lines is checked when running the extension, so I took the extension ID out of the second.

UPDATE!

1.1.2 might be 1.2.0 soon... found a problem on 6.1 (in alpha pre-release now) where it will change the settings in memory, but they aren't written to the DB. Investigating, holding up that release until I find out why and get a fix in.

Edited by user Tuesday, December 13, 2016 8:17:12 PM(UTC)  | Reason: Not specified

ScreenConnect Team
thanks 3 users thanked Steven for this useful post.
Kostya on 12/19/2016(UTC), marktoo on 1/19/2017(UTC), JoeW on 5/29/2017(UTC)
Matt Highsmith  
#26 Posted : Wednesday, December 14, 2016 9:33:01 PM(UTC)
Matt Highsmith


Rank: Advanced Member

Medals: ScreenConnect Advisor: Focus Group MemberLevel 2: Lent a Helping Hand! 10 Thanks!

Joined: 4/1/2014(UTC)
Posts: 224
United States
Location: Raleigh

Thanks: 2 times
Was thanked: 15 time(s) in 11 post(s)
@Steven,

Thanks that resolved the issue that i was having. Works like a charm now
Steve Sobka  
#27 Posted : Thursday, January 19, 2017 6:54:13 PM(UTC)
Steve Sobka


Rank: Guest

Joined: 12/5/2016(UTC)
Posts: 1
United States
Location: Los Angeles

Using this extension, would it be possible to grab information from a ScreenConnect session that was launched from LabTech to change the name of the computer from the default $computername$ to: $ComputerName$ - $CustomerName$
We have servers that share the same name (SERVER1) and my engineers are finding it hard to keep track of which client they are connected to when they have 10 windows open that all say SERVER1.

tymills  
#28 Posted : Friday, January 20, 2017 9:00:49 PM(UTC)
tymills


Rank: Guest

Joined: 1/20/2017(UTC)
Posts: 1

Steven,

I am curious about the first statement you make:

"""When first building the access installer, it is possible to do so using a variable within the Access Installer Builder's fields, which will work for Windows Vista and newer OSes, and Windows XP if you side-load SETX."""

I take this to mean that in vanilla Screenconnect you can pull info from System variables and add them to a Custom Property at install by setting it up correctly under the 'Build +' dialogue. This only happens at install time and doesn't update.

This is exactly what I am trying to accomplish, I would like CustomPropery3 to pull the current system time as a way to keep track of the "Install Date" of particular Screenconnect sessions.

Under the 'Build +' dialog I have tried to set CustomProperty3 to '%date%' and 'date', but it just sets the custom property to that exact string. (ie '%date%' and 'date' when I expect 'Fri 01/20/2017')

Am I missing something here? Just let me know, thanks.

Edited by user Friday, January 20, 2017 9:02:33 PM(UTC)  | Reason: Not specified

shawnkhall  
#29 Posted : Monday, April 3, 2017 6:58:50 AM(UTC)
shawnkhall


Rank: Advanced Member

Medals: Level 1: Random Act of Kindness! Received One Thanks!

Joined: 2/6/2014(UTC)
Posts: 166
Man
United States

Thanks: 5 times
Was thanked: 8 time(s) in 6 post(s)
Is it possible to use this to set a note instead of a CustomProperty?

If not, can it be made to operate that way?
Steven  
#30 Posted : Tuesday, April 4, 2017 3:02:12 PM(UTC)
Steven


Rank: Administration

Medals: Level 1: Random Act of Kindness! Received One Thanks!

Joined: 5/1/2015(UTC)
Posts: 53
United States
Location: Tampa, FL

Was thanked: 12 time(s) in 8 post(s)
Hi Shawn,

Thanks for the inquiry. Currently it does not modify session notes at all, but it wouldn't be too hard to refactor it to do that instead, or to add it. I'll take a look into it when I get some more time, but basically I use the UpdateSession API (https://help.screenconnect.com/Session_Manager_API_Reference#UpdateSession.28byHost.2C_sessionID.2C_name.2C_isPublic.2C_code.2C_customPropertyValues.29) to update the session info. The notes would just need to use the AddSessionEvent instead(https://help.screenconnect.com/Session_Manager_API_Reference#AddSessionEvent.28sessionID.2C_sessionEvent.29).

Note, I would probably make it so that that it would just add a new note each time it's run as opposed to trying to keep a single note up to date, as that is where custom properties are really useful.

Keep an eye out for the next version :)
ScreenConnect Team
promptcare  
#31 Posted : Friday, April 7, 2017 4:24:37 PM(UTC)
promptcare


Rank: Advanced Member

Medals: ScreenConnect Advisor: Focus Group MemberLevel 2: Lent a Helping Hand! 10 Thanks!

Joined: 9/14/2011(UTC)
Posts: 353
Location: ON, Canada

Thanks: 30 times
Was thanked: 13 time(s) in 11 post(s)
I'm not a powershell guru but I'm curious if there would be any way to use this to set it to show, say, CustomProperty4 as the last boot time. My residentials are terrible at rebooting so, rather than running "net statistics workstation | find /i "statistics since"" from the Command Toolbox on the whole set and then having to look at each one's CMD tab individually, it could populate one field so that I could see a bunch at a time.

I guess the problem might be that it might not update itself dynamically and would have to be Reinstalled to force an update. Is that right?
dbuerger  
#32 Posted : Tuesday, May 9, 2017 5:05:51 PM(UTC)
dbuerger


Rank: Guest

Joined: 10/24/2016(UTC)
Posts: 2
United States
Location: PA

With the newest version of Screen Connect 6.2.12963.6312, it now appears on 64bit Window OS the extension is running in Powershell 64bit, previously it was running in Powershell 32bit still. Is there anyway to stay use 32bit Powershell so I can use "Provider=Microsoft.Jet.OLEDB.4.0"?
shawnkhall  
#33 Posted : Tuesday, May 9, 2017 5:48:35 PM(UTC)
shawnkhall


Rank: Advanced Member

Medals: Level 1: Random Act of Kindness! Received One Thanks!

Joined: 2/6/2014(UTC)
Posts: 166
Man
United States

Thanks: 5 times
Was thanked: 8 time(s) in 6 post(s)
you can rewrite the call so it runs it via a CMD instead. use the following path to compose your collector:
"%SystemRoot%\SysWOW64\WindowsPowerShell\v1.0\powershell.exe"
JoeW  
#34 Posted : Monday, May 29, 2017 10:51:45 AM(UTC)
JoeW


Rank: Guest

Joined: 5/9/2017(UTC)
Posts: 3
United Kingdom

Thanks: 2 times
Win7 work around: ThumpUp

Anyone seeing that after you update the variables any custom computer name set using Edit > "Use Specific Value" is reset back to "Use Machine Name"?

Plugin: v1.1.1
SC: v6.2.12963.6312
Steven  
#35 Posted : Wednesday, June 21, 2017 2:09:20 PM(UTC)
Steven


Rank: Administration

Medals: Level 1: Random Act of Kindness! Received One Thanks!

Joined: 5/1/2015(UTC)
Posts: 53
United States
Location: Tampa, FL

Was thanked: 12 time(s) in 8 post(s)
Originally Posted by: promptcare Go to Quoted Post
I'm not a powershell guru but I'm curious if there would be any way to use this to set it to show, say, CustomProperty4 as the last boot time. My residentials are terrible at rebooting so, rather than running "net statistics workstation | find /i "statistics since"" from the Command Toolbox on the whole set and then having to look at each one's CMD tab individually, it could populate one field so that I could see a bunch at a time.

I guess the problem might be that it might not update itself dynamically and would have to be Reinstalled to force an update. Is that right?


One way to do this would be to setup your CustomProperty4VariableName to something like: lastsystemstarttime
Then, in the WindowsPreCommand area, enter: for /F "tokens=1,2,*" %%1 in ('net statistics workstation ^| findstr -i "since"') DO set lastsystemstarttime=%%3
If you're on the Host page doing this, click SAVE SETTINGS & RUN COMMAND (if the Edit Extension Settings modal does not go away, refresh the page in the browser)
Right click the session and select "Update Properties from Variables" and wait a few seconds. You can check the commands tab for when the response comes in.
A short second or so after it comes in, the Custom Propety 4 should be updated for the system...


*** NOTE: While testing this, I did find a bug or two. The first is that clicking Save Settings & Run Command does save the settings, and attempts to run the command, but does not close the modal prompt, and does not update the commands for the current view of the page (at least in 6.3). I'll be working on getting this working as expected again.

The other issue is that, (again, at least in 6.3, need to test previous versions to find where it started) while the data is updated in the controller on the server, and therefore page data will show the changes to the sessions, this change does not seem to get committed to the database, as a restart of the services (such as when upgrading the server) causes the changes to the items to be reverted. Also reporting does not reflect the changes. I'll be working on this as well for the next version.
ScreenConnect Team
Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.