Keep your laptop running when LID is Closed

Background

There is really not much need to keep a laptop’s lid opened when connected to an external monitor.

OS

Linux

Outline

  1. Launch terminal
  2. sudo to root
  3. edit /etc/systemd/logind.conf
    • Change folder to /etc/systemd
    • Backup current logind.conf
    • Launch editor ( vi) and pass along file name ( logind.conf )
    • Keep current HandleLidSwitch=suspend commented out
    • Add HandleLidSwitch=lock
    • Save Changes
    • Exit Editor
  4. Restart Services
    • Restart systemd-logind.service
      • Command :- systemctl restart systemd-logind.service

 

Images

logind.conf
logind.conf – Original

logind.conf.20181108.0740PM.PNG

logind.conf – Revised

logind.conf.20181108.0746PM.PNG

 

Windows

Outline

  1. Access Control Panel \ Power Options\ System Settings
    • Select “Choose what the Power Buttons do”
    • The “Control Panel\All Control Panel Items\Power Options\System Settings” window appears
      • Access the “Power and sleep buttons and lid settings” group box
      • Focus on “when I close the lid” area
        • There are two options
        • The first been “On Battery” and the other “When plugged in”

Images

Control Panel \ All Control Panel Items \ Power Options \ System Settings

Original

systemSettings.closeLid.20181108.0756PM.PNG

Revised

systemSettings.closeLid.20181108.0758PM.PNG

 

Validation

The steps above were validated on the OSes listed below:

  1. Linux
    • Cent OS
  2. MS Windows
    • Version 10

References

  1. Redhat
    • Products & Services > Product Documentation > Red Hat Enterprise Linux > 7 > Desktop Migration and Administration Guide
      • 13.10. Preventing the Computer from Suspending when Closing the Lid
        Link

Echo Data to Powershell

Background

Trying to automate a little app.

As Powershell is a modern development tool and I do not need to compile the source code wanted to try it out first.

Exercise

Our need is very narrow.

The app is requesting that we enter our full name.

Really did not want to engage with the app so intimately and will rather feed its input through another channel.

Code

Powershell


$fullname = Read-Host -Prompt 'Please enter first and last name'

$line = "The name you entered is {0}" -f $fullname

Write-Host $line

CommandShell


@echo off

setlocal

    set "_fullname=Daniel Adeniji"

    set "_app=acceptKeyStroke.ps1"

    echo %_fullname% | powershell -f %_app%

endlocal

Output

echoToPowershell_20181025_0810AM.PNG

Win OS – Error – “Replication of license information failed because the License Logging Service on server could not be contacted”

Background

Reviewing MS Windows Event Viewer and noticed a recurring error “Replication of license information failed because the License Logging Service on server [server-name] could not be contacted“.

Error

Event Viewer

Event Properties

Here is the error message…

Image

eventProperties_20180904_0119AM.png

Textual

  1. Source :- LicenseService
  2. Event ID :- 213

 

Events

Image

eventViewer_20180904_0119AM.png

Troubleshooting

Logging Service

Googled on the error message and directed to check the “Logging Service” on the remote computer.

Computer Manager

Launched “Computer Manager” and connected to remote computer.

Services

Service – License Logging

Outline
  1. Changed Service Mode from disabled to Automatic
  2. Start Service
Original – Service – Disabled
Image

licenseLogging_Disabled_20180904_0121AM.png

 

Service – Startup Type – Changed to Automatic
Image

licenseLogging_Automatic_20180904_0122AM.png

Service – Service Started
Image

licenseLogging_Automatic_Started_20180904_0123AM.png

Win OS – Run Application has an Administrator

Background

In a previous post, “Data Studio – Error – ‘configuration\org.eclipse.osgi.manager.fileTableLock (Access is denied.)’ ”, spoke of the need to run an application as an Administrator.

That post is here.

Always “Run As An Administrator

Let us see what it will take to always run an Application as an Administrator.

Guide

Googled on our title and found a very worthy post.

It is by “Sarah Jacobsson Purewal” and it is titled “Always run a program in administrator mode in Windows 10” as our guide.

That post is here.

Steps

Outline

  1. Identify Application Launcher
  2. Review Application Launcher
    • Review Application’s folder and binary name
  3. Change Application’s compatibility mode
    • Change “Run as an Administrator” mode for all users

Identify Application Launcher

Search for Application

In Windows Desktop, please search for the Application.

In our case “IBM Data Studio“.

desktop_datastudio_properties_20180830_0848AM.PNG

Open file Location

Please right click on the app and the drop-down menu appears.

From the drop-down menu, please choose “Open File Location“.

desktop_datastudio_openfilelocation_20180830_0853AM

Review Application Launcher

Start Menu \ Programs \ [Application]

Here is what the start menu for our application looks like.

startmenu_programs_ibmdatastudio_20180830_0903AM.PNG

Start Menu \ Programs \ [Application] \ [shortcut]

Let us access the short cut that we want to dig into.

Data Studio 4.1.3.3 Client
Properties

We selected the shortcut and right clicked on it.

Here is what our drop-down looks like.

startmenu_programs_ibmdatastudio_properties_dropdown_20180830_0910AM

Shortcut – Image

startmenu_datastudio_properties_shortcut_20180830_0914AM.PNG

Shortcut -Textual
  1. Target :- “E:\Program Files\IBM\DS4.1.3\eclipse.exe” -product com.ibm.datastudio.consolidated.product.ide
  2. Start In :- “E:\Program Files\IBM\DS4.1.3”

 

Application’s compatibility mode

Our application’s full name is “E:\Program Files\IBM\DS4.1.3\eclipse.exe”.

Let us go set its compatibility mode.

Windows Explorer

Using Windows Explorer, we accessed our application’s folder, E:\Program Files\IBM\DS4.1.3\.

windowsExplorer_IBMDataStudio_20180830_0926AM

 

Windows Explorer – Application

We selected our application and right clicked on it.

windowsExplorer_IBMDataStudio_properties_20180830_0928AM

Properties

Properties – Tab – General

Here is the initial tab when the Properties for an Application is accessed.

Properties_eclipse.exe_tab_general_20180830.0934AM

Properties – Tab – Compatibility

Please access the Compatibility tab.

Properties_eclipse.exe_tab_compatibility_01_20180830.0937AM

Please click on the “Change Setting for all users” button.

Properties – Tab – Compatibility – Change Settings for all users

Here is what the “Change Settings for all users” window look like.

Properties_eclipse.exe_tab_compatibility_changeSettigforallusers_01_20180830.0941AM

Please make the changes identified below:

  1. Run this program as an Administrator

Here is a screen that reflects our change.

eclipse.exe.compatibilityforallusers.20180830.0945AM

 

Dedication

Dedicated to Sarah Jacobsson Purewal.

On MS Windows, Profiling Java Apps Memory Utilization Using VMMap

Background

In our last post, we covered the usage of a few Oracle standard tools to profile Java Applications.

BTW the referenced post is available here.

 

SysInternals

VMMap

In this post, we will briefly cover using SysInternal’s VMMap GUI to track down memory utilization.

 

Artifact

VMMap is available from here.

The current version is v3.21 and it was released a couple of years ago; July 20, 2015 to be exact.

Download & Extract

Download and Extract it; no need for installation.

Usage

ElasticSearch

Select or Launch Process

 

Metrics

 

WebSphere

Select or Launch Process

 

Metric

WinOS – Restart Computer through Script

Background

Needing to restart a computer that is not accessible via Remote Desktop.

Script

DOS Batch

Here is a Dos Script that can help.

Outline

  1. Expects lone argument passed in to be computer name of host to restart
  2. Initiates shutdown.exe
    • /r :- Restart
    • /d p:0:0 :- Reason is a planned restart
    • /m :- Computer that is target of restart
    • /c :- Reason
      • User that initiated restart and host restarted from

Code


@echo on

setlocal

rem /r
rem restart computer

rem /d 
rem   p = planned restart

if [%1]==[] (
	echo Please pass along computer name as first parameter
	echo Exiting Script
	goto :endofScript
	)

set "_usernamefull=%USERDOMAIN%\%USERNAME%"

set "_computer=%1"

set "_reason=Planned restart by %_usernamefull% from host %COMPUTERNAME%"

shutdown.exe /r /d p:0:0 /m \\%_computer% /c "%_reason%"

:endofScript

endlocal

Output

Output #1

Image

Textual

LABDB: The entered computer name is not valid or remote shutdown is not supported on the target computer. Check the name and then try again or contact your system administrator.(53)

Output #2

Image

Textual

You're about to be signed out
Windows will shut down in less than a minute.

Bigfix – Error – “The specified target is unknown or unreachable”

Background

Trying to configure our BigFix Application Server, but running into the error pasted below.

Error

Image

failedToConnectTheSpecificTargetIsUnknown_20180713_0400PM [BrushedUp

Textual


Failed to connect to https://bigfixsrv:52311:
Windows Error 0x80090303

Remediation

Network

netstat

Command


netstat -an | find "52311"

Explanation

Noticed network connections on our Application’s port ( 52311).

Active Directory

Service Principal Name ( SPN )

setspn

Overview

SPN is formatted as such :-

serviceclass/host:port servicename

Here is a quick breakdown of each element

  1. Serviceclass
    • For Bigfix, the service class registered is iem
  2. Host
    • The computer name
  3. Port
    • If other than the default port number for the application
  4. Service Name
    • It our case it will be the Active Domain Account that our service will be running under

 

Syntax
Syntax – List

REM List SPN entries for computer
setspn -L [computer]

Syntax – Add

REM Add iem account for computer
setspn -S iem/[computer] [user]

Sample

setlocal

set "_comp=BIGFIXSRV"
set "_compFQDN=BIGFIXSRV.LAB"
set "_user=LAB\servicebf"

REM Remove Previous iem account ( Computer )
setspn -D iem/%_comp% %_comp%

REM Remove Previous iem account ( FQDN )
setspn -D iem/%_compFQDN% %_comp%

REM Add iem account (Computer) 
setspn -S iem/%_comp%  %_user%

REM Add iem account  ( FQDN )
setspn -S iem/%_compFQDN% %_user%

REM List spn for computer
setspn -l %_comp%

REM List spn for user
setspn -l %_user%


endlocal

References

  1. IBM
    • Support
      • Pass-Through Authentication failing
        Link
    • IBM Knowledge Center \ SSPS Modeler  \ Configure Single Sign-On
      • The Service Principal Name
        Link
  2. Microsoft
    • Setspn
  3. Viruk67 – You Want It When!
    • Setting the NetworkService as an SPN account
      Link