Skip to content

Commit

Permalink
osInfo() added remoteSession (windows)
Browse files Browse the repository at this point in the history
  • Loading branch information
sebhildebrandt committed Feb 12, 2021
1 parent 660377b commit 469a761
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions lib/osinfo.js
Expand Up @@ -324,6 +324,7 @@ function osInfo(callback) {
const workload = [];
workload.push(util.wmic('os get /value'));
workload.push(execPromise('systeminfo', util.execOptsWin));
workload.push(util.powerShell('Add-Type -AssemblyName System.Windows.Forms; [System.Windows.Forms.SystemInformation]::TerminalServerSession'))
util.promiseAll(
workload
).then(data => {
Expand All @@ -335,13 +336,8 @@ function osInfo(callback) {
result.codepage = util.getCodepage();
const systeminfo = data.results[1] ? data.results[1].toString() : '';
result.hypervisor = (systeminfo.indexOf('hypervisor has been detected') !== -1) || (systeminfo.indexOf('Es wurde ein Hypervisor erkannt') !== -1) || (systeminfo.indexOf('Un hyperviseur a ') !== -1);
// isTerminalSession
try {
const term = execSync('Add-Type -AssemblyName System.Windows.Forms; [System.Windows.Forms.SystemInformation]::TerminalServerSession').toString();
result.remoteSession = (term.toLowerCase().indexOf('true') >= 0);
} catch (e) {
util.noop();
}
const term = data.results[2] ? data.results[2].toString() : '';
result.remoteSession = (term.toString().toLowerCase().indexOf('true') >= 0);
isUefiWindows().then(uefi => {
result.uefi = uefi;
if (callback) {
Expand Down

0 comments on commit 469a761

Please sign in to comment.