Sorry, command-not-found has crashed! Please file a bug report at – Ubuntu

xli@abyss00123-vm:~$ getnet
Sorry, command-not-found has crashed! Please file a bug report at:
https://bugs.launchpad.net/command-not-found/+filebug
Please include the following information with the report:

command-not-found version: 0.3
Python version: 3.8.5 final 0
Distributor ID:	Ubuntu
Description:	Ubuntu 20.04.2 LTS
Release:	20.04
Codename:	focal
Exception information:

unable to open database file
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/CommandNotFound/util.py", line 23, in crash_guard
    callback()
  File "/usr/lib/command-not-found", line 90, in main
    cnf = CommandNotFound.CommandNotFound(options.data_dir)
  File "/usr/lib/python3/dist-packages/CommandNotFound/CommandNotFound.py", line 79, in __init__
    self.db = SqliteDatabase(dbpath)
  File "/usr/lib/python3/dist-packages/CommandNotFound/db/db.py", line 12, in __init__
    self.con = sqlite3.connect(filename)
sqlite3.OperationalError: unable to open database file
xli@abyss00123-vm:~$ 

Fix:

sudo chmod ugo+r /var/lib/command-not-found/commands.db*

Send-MailMessage Powershell

Create a file with the encrypted server password:

In Powershell, enter the following command (replace myPassword with your actual password):

"myPassword" | ConvertTo-SecureString -AsPlainText -Force | ConvertFrom-SecureString | Out-File "C:\EmailPassword.txt"

Create a powershell script (Ex. sendEmail.ps1):

$User = "usernameForEmailPassword@gmail.com"
$File = "C:\EmailPassword.txt"
$cred=New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $User, (Get-Content $File | ConvertTo-SecureString)
$EmailTo = "emailTo@yahoo.com"
$EmailFrom = "emailFrom@gmail.com"
$Subject = "Email Subject" 
$Body = "Email body text" 
$SMTPServer = "smtp.gmail.com" 
$filenameAndPath = "C:\fileIwantToSend.csv"
$SMTPMessage = New-Object System.Net.Mail.MailMessage($EmailFrom,$EmailTo,$Subject,$Body)
$attachment = New-Object System.Net.Mail.Attachment($filenameAndPath)
$SMTPMessage.Attachments.Add($attachment)
$SMTPClient = New-Object Net.Mail.SmtpClient($SmtpServer, 587) 
$SMTPClient.EnableSsl = $true 
$SMTPClient.Credentials = New-Object System.Net.NetworkCredential($cred.UserName, $cred.Password); 
$SMTPClient.Send($SMTPMessage)

Automate with Task Scheduler:

Create a batch file (Ex. emailFile.bat) with the following:

powershell -ExecutionPolicy ByPass -File C:\sendEmail.ps1

Create a task to run the batch file. Note: you must have the task run with the same user account that you used to encrypted the password! (Aka, probably the logged in user)

That’s all; you now have a way to automate and schedule sending an email and an attachment with Windows Task Scheduler and Powershell. No 3rd party software and the password is not stored as plain text (though granted, not terribly secure either).

How to Clear File Explorer Address Bar History in Windows 10

1. Clear Address Bar History from File Explorer

The easiest way to clear address bar history is to use the quick and easy file explorer right click option. With just a couple of clicks, Windows will clear the file explorer’s address bar history.

  1. First, open file explorer by clicking on the taskbar icon or by pressing the Win + I keyboard shortcut.
  2. In the file explorer, right-click on the address bar and select “Delete History” option.
    Clear file explorer address bar history 02
  3. As soon as you select the option, Windows will delete the address bar history.
    Clear file explorer address bar history 03

2. Delete Address Bar by Editing Registry Values

If the above two methods did not work for some reason, you can try editing the registry to clear windows explorer address bar. You see, all the history items in the file explorer are stored as an individual value within the registry editor. By deleting those values, you can delete the file explorer address bar history.

Also, since the history items are stored as individual values, you can delete specific keys to clear specific items from the address bar history. For instance, maybe you don’t want a specific folder address to appear in the address bar history. In those situations, deleting specific registry value will get the job done.

For this specific purpose, though editing registry is fairly easy, I’d recommend you back up the registry so that you can restore in case of any mishaps.

  1. Open the Run dialog box using Win + R, type regedit and click on the “Ok” button to open the Windows Registry Editor.
  2. In the editor, copy and paste the below path in the address bar and press Enter. This action will take you to the target folder where the file explorer history values are stored.HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\TypedPathsClear file explorer address bar history 06
  3. On the right panel, you will see multiple values like url1, url2, etc. To delete a single entry from the file explorer history, right-click on the target value and select the “Delete” option.
    Delete file explorer address bar history 07
  4. You will see a warning message. Simply click on the “Yes” button to continue.
    Delete file explorer address bar history 08
  5. To clear the entire file explorer history, select all the values except “Default”, right-click and select the “Delete” option.
    Delete file explorer address bar history 09
  6. You will see a warning message. Simply click on the “Yes” button to continue.
    Delete file explorer address bar history 10
  7. Close registry editor.
  8. Close and reopen the file explorer and the file explorer’s address bar history will be cleard automatiaclly.

refer https://windowsloop.com/clear-file-explorer-address-bar-history/

Use shortcut name instead full qualified domain on Ubuntu

Modify the file /etc/systemd/resolved.conf

add “Domains=xxxx.xxxxx” to the file

xli@xxxxxxx-vm:~$ more /etc/systemd/resolved.conf

This file is part of systemd.

#

systemd is free software; you can redistribute it and/or modify it

under the terms of the GNU Lesser General Public License as published by

the Free Software Foundation; either version 2.1 of the License, or

(at your option) any later version.

#

Entries in this file show the compile time defaults.

You can change settings by editing this file.

Defaults can be restored by simply deleting this file.

#

See resolved.conf(5) for details

[Resolve]

DNS=

FallbackDNS=

Domains=

LLMNR=no

MulticastDNS=no

DNSSEC=no

DNSOverTLS=no

Cache=yes

DNSStubListener=yes

ReadEtcHosts=yes

Domains=internal.xxxxxx.xxxxx
xli@xxxxxx-vm:~$
xli@xxxxx-vm:~$
xli@xxxxxx-vm:~$ nslookup rds
Server: 127.0.0.53
Address: 127.0.0.53#53

Non-authoritative answer:
Name: rds.xxxxx.xxxx.xxxxxx
Address: 10.137.1.x

Reset Terminal Server (RDS) Grace Period using PowerShell in Lab Environment

Reset Terminal Services Licensing Grace Period to 120 DaysWe often need to deploy Terminal Server (Remote Desktop Session Host in 2012) for testing purposes in development environments allowing more than 2 concurrent Remote Desktop Sessions on it. When it is installed, by default it is in default Grace licensing period which is 120 days and it works fine.

Once Grace period expires, the server does not allow even a single Remote Desktop session via RDP and all we can do is logon to the Console of machine using Physical/Virtual console depending on Physical or Virtual machines or try to get in using mstsc /admin or mstsc /console, then remove the role completely and restart the terminal server and it starts accepting default two RDP sessions.
We sometimes find ourselves in situation when server is nearing to the end of grace period and we don’t have a TS Licensing server in place and we need the default grace period to be reset/extended to next 120 days.
I have created a Script which can be used to query the remaining days of grace period and extend/reset it to next 120 days in case needed.
NEW : The script has been updated with a -Force switch, If -Force switch parameter is used, It will not ask for Y/N prompt while doing the reset.

Here is how to use this script without any prompt now:

.\Reset-TSGracePeriod.ps1 -Force
Alternatively I have also uploaded this code on My Github Repository which show the changes between old and new script.

https://github.com/Prakash82x/PowerShell/blob/master/TerminalService/Reset-TSGracePeriod.ps1

ORHere goes the code.

## This Script is intended to be used for Querying remaining time and resetting Terminal Server (RDS) Grace Licensing Period to Default 120 Days.## Developed by Prakash Kumar (prakash82x@gmail.com) May 28th 2016## www.adminthing.blogspot.com## Disclaimer: Please test this script in your test environment before executing on any production server.## Author will not be responsible for any misuse/damage caused by using it.Param(        [Parameter(Mandatory=$false)] [Switch]$Force     )
Clear-Host$ErrorActionPreference = “SilentlyContinue”
## Display current Status of remaining days from Grace period.$GracePeriod = (Invoke-WmiMethod -PATH (gwmi -namespace root\cimv2\terminalservices -class win32_terminalservicesetting).__PATH -name GetGracePeriodDays).daysleftWrite-Host -fore Green ======================================================Write-Host -fore Green ‘Terminal Server (RDS) grace period Days remaining are’ : $GracePeriodWrite-Host -fore Green ====================================================== Write-Host
## Check if -Force Parameter has been used, If so, It will not prompt for Y/N while executing the script and will simply reset the Grace Period.If (-not $Force){$Response = Read-Host “Do you want to reset Terminal Server (RDS) Grace period to Default 120 Days ? (Y/N)”}
if ($Response -eq “Y” -or $Force) {## Reset Terminal Services Grace period to 120 Days
$definition = @”using System;using System.Runtime.InteropServices;namespace Win32Api{          public class NtDll          {                    [DllImport(“ntdll.dll”, EntryPoint=”RtlAdjustPrivilege”)]                    public static extern int RtlAdjustPrivilege(ulong Privilege, bool Enable, bool CurrentThread, ref bool Enabled);          }}”@
Add-Type -TypeDefinition $definition -PassThru
$bEnabled = $false
## Enable SeTakeOwnershipPrivilege$res = [Win32Api.NtDll]::RtlAdjustPrivilege(9, $true, $false, [ref]$bEnabled)
## Take Ownership on the Key$key = [Microsoft.Win32.Registry]::LocalMachine.OpenSubKey(“SYSTEM\CurrentControlSet\Control\Terminal Server\RCM\GracePeriod”, [Microsoft.Win32.RegistryKeyPermissionCheck]::ReadWriteSubTree,[System.Security.AccessControl.RegistryRights]::takeownership)$acl = $key.GetAccessControl()$acl.SetOwner([System.Security.Principal.NTAccount]”Administrators”)$key.SetAccessControl($acl)
## Assign Full Controll permissions to Administrators on the key.$rule = New-Object System.Security.AccessControl.RegistryAccessRule (“Administrators”,”FullControl”,”Allow”)$acl.SetAccessRule($rule)$key.SetAccessControl($acl)
## Finally Delete the key which resets the Grace Period counter to 120 Days.Remove-Item ‘HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\RCM\GracePeriod’
write-hostWrite-host -ForegroundColor Red ‘Resetting, Please Wait….’Start-Sleep -Seconds 10
}
Else    {Write-HostWrite-Host -ForegroundColor Yellow ‘**You Chose not to reset Grace period of Terminal Server (RDS) Licensing’  }
## Display Remaining Days again as final statustlsbln.exe$GracePost = (Invoke-WmiMethod -PATH (gwmi -namespace root\cimv2\terminalservices -class win32_terminalservicesetting).__PATH -name GetGracePeriodDays).daysleftWrite-HostWrite-Host -fore Yellow =====================================================Write-Host -fore Yellow ‘Terminal Server (RDS) grace period Days remaining are’ : $GracePostWrite-Host -fore Yellow =====================================================
if ($Response -eq “Y” -or $Force){Write-Host -Fore Cyan `n”IMPORTANT: Please make sure you restart following services manually to bring this reset in effect:`n`n* Remote Desktop Configuration Properties `n* Remote Desktop Services”}
## Cleanup of VariableRemove-Variable * -ErrorAction SilentlyContinue

##End of Code##

Note: You will have to restart following services for the reset to come into effect.

Remote Desktop Configuration Properties

Remote Desktop Services

As soon as these services are restarted all the active sessions will be disconnected (Not logged off), Wait for a minute and reconnect again.

refer: https://adminthing.blogspot.com/2016/05/reset-ts-rds-grace-period.html

download the powershell script:

Add additional folders to sync to One Drive

We use junction to reach the target.

  1. Open CMD
  2. type following command

    mklink /j “%UserProfile%\OneDrive\Folder Name” “Full path of source folder”

    e.g.

    mklink /j “%UserProfile%\OneDrive\Seagate2″ ” D:\others\Seagate2″

C:\Users\Administrator>mklink /j “%UserProfile%\OneDrive\Seagate2″ ” D:\others\Seagate2″

Junction created for C:\Users\Administrator\OneDrive\Seagate2 <<===>>  D:\others\Seagate2

C:\Users\Administrator>

OneDrive shows red cross on icon and shows “can’t sync now”

Do following

Go to: C:\Users\AppData\Local\Microsoft\OneDrive\settings\Business1\ClientPolicy.ini and change MaxClientMBTransferredPerDay from 1048576 to something higher, such as 2048576.

restart one drive, and it fixed issue.

above is only a temp fix, as ClientPolicy.ini will back to original after couple of mins.

deleted all session files” a1dad551-e463-4597-8fd1-18436ade55bc” in C:\Users\AppData\Local\Microsoft\OneDrive\settings\Business1\, login and setup the Onedrive again.

maybe modify the session file can fix the issue as well, need to test out.