Win OS :- Remove Temporary Internet Files

Background

Wanted to remove left behind temporary Internet files.

Folder Stats

C:\Users

WinDirStat

Images

Image – WinDirStat

winDirStat.20181218.0249PM.PNG

Explanation
  1. 16 GB

Windows Explorer

Images

Image – Windows Explorer

folderExplorer.TemporaryInternetFiles.20181218.0228PM.PNG

Explanation
  1. 15.9 GB

Script

Script- Dos/Batch

@echo off

rem *************************************************************************************************

    rem https://community.f-secure.com/t5/Common-topics/Cleaning-temporary-Internet/ta-p/18280

    rem In Windows XP, the folder is located here:

        rem C:\Documents and Settings\\Local Settings\Temporary Internet Files\Content.IE5
        rem Note: If you only have one user account on Windows XP, use Administrator as the username.

    rem In Windows Vista and 7, the folder is located here:

        rem C:\Users\\AppData\Local\Microsoft\Windows\Temporary Internet Files\Content.IE5
        rem C:\Users\\AppData\Local\Microsoft\Windows\Temporary Internet Files\Low\Content.IE5

    rem In Windows 8 and 8.1, the folder is located here:
        rem C:\Users\\AppData\Local\Microsoft\Windows\INetCache

    rem *************************************************************************************************

setlocal enabledelayedexpansion

IF "%OS%"=="" GOTO WIN9X

REM Clear Local Variables
rem set "_folderSuffix="
rem set "_folderLowSuffix="

set _folderSuffix=
set _folderLowSuffix=

if exist "%SystemDrive%\Users\%username%\AppData\Local\Microsoft\Windows\Temporary Internet Files\Content.IE5"  (

	set "_folderSuffix=AppData\Local\Microsoft\Windows\Temporary Internet Files\Content.IE5"
	set "_folderLowSuffix=AppData\Local\Microsoft\Windows\Temporary Internet Files\Low\Content.IE5"

)

if exist "%SystemDrive%\Users\%username%\AppData\Local\Microsoft\Windows\INetCache"  (

	set "_folderSuffix=AppData\Local\Microsoft\Windows\INetCache"

)

set "_users=%SystemDrive%\Users"

FOR /D %%F in ("%_users%\*") do (

     set _folder=%%F

     set "_folderContent=%%F\%_folderSuffix%"    

	 if not "%_folderLowSuffix%"=="" (
		set "_folderLowContent=%%F\%_folderLowSuffix%"

		)

     echo Folder Base is !_folder!

     echo Folder Content Regular is !_folderContent!

     dir "!_folderContent!"\* /s 2>nul | find /v /c "::"

     if exist "!%_folderLowContent%" (

		echo Folder Content Low is !_folderLowContent!

		dir "!_folderLowContent!"\* /s 2>nul | find /v /c "::"

	)		

     echo *******************************************************************

     rem dir
     if "%1"=="dir" dir "!_folderContent!"\* /s /Q 2>nul 

     if exist "%%F\%_folderLowSuffix%" (

		if "%1"=="dir" dir "!_folderLowContent!"\* /s /Q 2>nul      

	 )		

     rem del
     if "%1"=="del" del "!_folderContent!"\* /s /Q 2>nul 

     if exist "%%F\%_folderLowSuffix%" (

		if "%1"=="del" del "!_folderLowContent!"\* /s /Q 2>nul      

	)	

)

:GOTO END

:WIN9X

REM - WIN9X systems are currently not supported.

:END

endlocal

Source Code Control

GitHub

DanielAdeniji/winOSInternetTempfilesCleanup
Link

 

MS Windows – List Groups a user belongs to

Background

Let us use built-in tools to review our Active Directory group memberships.

Outline

  1. whoami
    • whoami /groups
  2. dsquery
    • dsquery | dsget

Machine

whoami

whoami – List Local Groups

Script

whoami /groups /fo csv | find /V "%USERDOMAIN%\" | more

Output

whoami – List Domain Groups

Script

whoami /groups /fo csv | find "%USERDOMAIN%\" | more

 

Domain

dsquery

dsquery | dsget

Script

dsquery user -samid %username% | dsget user -memberof

Output

dsquery_dsget_20170929_0400pm.png

References

  1. whoami
    • Command Line Reference
      Link
    • John Savill
      • How can I determine which groups I’m a member of for my current logon session?
        Link
  2. dsquery // dsget
    • ss64.com
      • DSQuery user (installable option either via RSAT /AD DS or adminpack.msi)
        Link
      • StackExchange
        • superuser.com
          • Using the “net user” command in Windows XP to list all group memberships for a specific Active Directory user
            Link

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

grep & findstr

Background

Depending on your OS, grep on Linux and findstr on Windows might be one of your better friends.

Wish

Let us digest DB/2 Buffer Pool utilization on Linux and MS Windows.

OS

Linux

Syntax


db2 GET SNAPSHOT FOR BUFFERPOOLS ON [database] | grep 'pattern-1\|pattern-2'

Sample


db2 GET SNAPSHOT FOR BUFFERPOOLS ON WideWrld | grep 'Bufferpool name\|Current size'

Output

metadata.currentSize.20181106.0315PM.PNG

MS Windows

Syntax


db2 GET SNAPSHOT FOR BUFFERPOOLS ON [database] | findstr /C 'pattern-1' /C 'pattern-2'

Sample


db2 GET SNAPSHOT for bufferpools on WIDEWRLD | findstr /C:"Bufferpool name" /C:"Current size"<span id="mce_SELREST_start" style="overflow:hidden;line-height:0;">&#65279;</span>

Output

metadata.currentSize.WIDEWRLD.20181106.0349PM

Finding Binaries

Background

Trying to explore the various avenues for finding binaries in Linux & MS Windows.

Linux

Outline

  1. locate
  2. which

Command

locate

Outline

locate reads one or more databases prepared by updatedb and writes
file names matching to standard output, one per line.

By default, locate does not check whether files found in database still
exist. locate can never report files created after the most recent
update of the relevant database.

 

Syntax
locate [command]

Syntax

locate ilist

Output

linux_locate_20180912_0402PM

which

Outline

Which takes one or more arguments. For each of its arguments it prints
to stdout the full path of the executables that would have been exe-
cuted when this argument had been entered at the shell prompt. It does
this by searching for an executable or script in the directories listed
in the environment variable PATH using the same algorithm as bash.

Syntax

which [command]

Sample

which ilist

Output

linux_which_20180912_0254PM.PNG

 

MS Windows

Outline

  1. where

Command

where

Outline

Displays the location of files that match the search pattern.
By default, the search is done along the current directory and in the paths specified by the PATH environment variable.

Syntax

where [command]

Sample

where ilist

Output

where_20180912_0411PM

Error: “The requested operation could not be completed due to a file system limitation (mscorlib”

Background

Experiencing an error when trying to run an embedded process.  Part of the functionality that is bundled in the process, is a file copying module.

Error Message

Here is the error message :-

*** Error: The requested operation could not be completed due to a file system limitation (mscorlib) ***

Trouble Shooting

Application Message

Thankfully the particular file that is copied is logged, as well.


Copying log backup file to temporary work file. Source: '\\LABDB\Backup\hrdb_20180703104507.trn', Destination: '\\LABMirror\backup\HRDB_20180703104507.wrk'

Fast Copy

Attempted same file copy in FastCopy.

And, again thankfully it reported an error message; along with an error number.

Image

FastCopy_20180705_0712PM_v2.png

Text


WriteFileWait(The requested operation could not be completed due to a file system limitation665) : \\LABMirror\backup\HRDB_20180703104507.wrk
TotalRead  = 40,414 MB
TotalWrite = 40,289 MB
TotalFiles = 0 (0)
TotalTime  = 26:50
TransRate  = 25.0 MB/s
FileRate   = 0.00 files/s 

Explanation

  1. Error
    • Error Operation :- WriteFileWait
    • Error Description :- The requested operation could not be completed due to a file system limitation
    • Error Number :- 665

Error Causation

There are a few probably causes for error number 665.

Compression?

File

Finally, we checked the compression setting on other files in the targeted folder.

File Property

Image

file_20180706020000_trn_brushedup.png

Textual
  1. Size :- 2.07 GB
  2. Size on Disk :- 760 MB
Explanation

We can see that our file is compressed.

 

Folder Settings

Reviewed the Folder’s Advanced Attributes.

Image

AdvancedSettings_20180705_0717PM.png

Explanation

  1. Compress Contents to save disk space ( is enabled )

Remediation

Compression

Setting

We turned off compression on the targeted folder.

Fast Copy

Retried Fast Copy and it worked successfully.

NoError__20180705_1014PM_v2.png

Summary

Wished the original application displayed the OS’s error number and not just a simple error text that read “Error: The requested operation could not be completed due to a file system limitation (mscorlib)“.

Thankfully, there was enough diagnostic data in regards to the original file and destination folder that allowed us to replay via a more illuminating tool.

Windows Subsystem for Linux ( WSL ) – Error – “The app that you are trying to run is not supported on this version of Windows”

 

Background

If you try to enable “Windows Subsystem for Linux” ( WSL ) on a Windows 10 machine, you may unfortunately run into the error noted in our title message.

 

Error

Error Message

Image

NotSupportedOnThisVersionOfWindows_20180612_1012PM.png

Textual


The app that you are trying to run is not supported on this version of Windows.

 

Steps to reproduce

Currently, I am able to reproduce this error very easily.

The pathway towards reproducing are simple and direct.

And, they are:

  1. lxrun.exe /install
  2. bash

The commands above are meant to enable Linux if not currently installed.

Why?

Why am I not able to enable Linux on my Windows 10 system.

Requirements

The basis requirements are :-

  1. Bitness
    • 32-bit ( NO )
    • 43-bit ( YES )
  2. MS Windows 10 – Marketing
    • Anniversary Update  ( 2016-August-2nd )
    • Creator Update ( 2017-April-5th )

 

Versioning

Version & Build

Let us go get our Version Number

There are a couple of ways to get our Version Number.

Outline

  1. Windows System
    • About
  2. Winver

Steps

Windows System – About

  1. Access Windows System
  2. In Windows System, click on the menu Item ( Help \ About )

Image

controlPanel_System_Help_About_20180613_1050PM

Explanation

  1. Windows Edition
    • Windows 10 Enterprise 2016 LTSB

 

winver

Image

winver_20180613_1058PM

Explanation

  1. Version :- 1607
  2. OS Build :- 14393.2312

Marketing

Let us use Wikipedia to map Version Number to the Marketing Name.

Image

Windows 10 version history
Link

wikipedia_20180613_1106PM

Explanation

Our version # is 1607.

1607 maps to “Anniversary Update”.

Can we get Linux ?

Can we enable Linux Sub-system?

MSFT’s documentation:

Install the Windows Subsystem for Linux
Link

Based on the doc referenced above, here are the Marketing Versions Supported:

  1. Anniversary Update  ( 2016-August-2nd )
  2. Creator Update ( 2017-April-5th )

But, we are still stuck!

Why Stuck

It appears that though we are able to take all the necessary steps :

  1. Enable Developer Mode
  2. Enable Linux Subsystem feature

but, because we are on LTSB, we are in a tight mud.

LTSB?

DUKE

TO LTSB or Not

Link

With the release of Windows 10 in 2015, Microsoft introduced a new sub-edition of Windows 10 Enterprise called “Long Term Servicing Branch” or “LTSB”. Each release of Windows 10 Enterprise LTSB will remain relatively unchanged–receiving only security updates and bug fixes, but no feature updates–through a 10-year lifespan.

To date, Microsoft has delivered two releases of Windows 10 Enterprise LTSB (2015 and 2016) with the next expected in 2019. While, according to Microsoft, LTSB was “designed for special-purpose PCs such as those used in point-of-sale systems or controlling factory or medical equipment”, some in IT have deployed it to common end-user computers, citing the benefit of having no Windows Store apps (which includes Microsoft Edge and Cortana) and no semi-annual feature updates to deal with.

However, recent articles and an updated Microsoft FAQ point out that, as released versions of Windows 10 Enterprise LTSB will not receive newer features, they will also not be supported on newer computer processors (such as Intel’s eighth-generation “Kaby Lake Refresh” architecture, released in August, 2017) . This introduces a potential down-side to deploying LTSB, but it’s not a new concept, as both Windows 7 and Windows 8.1, both still fully supported by Microsoft on older hardware, are only partially supported on Intel’s sixth-generation “Skylake” processors and are not supported on the seventh-generation “Kaby Lake” processors.