aliyev's notes

  • About

Uncategorized

Automatically Log off Disconnected User Sessions on Windows

September 15, 2020, by admin No comments yet

Simple Powershell code that can be used to immidiately logoff a closed RDP session on a Windows server using windows task scheduler to trigger its run at sessions disconnects.

$sessions = ((quser | Where-Object {$_ -match ‘Disc’}))
foreach ($session in $sessions) {

$sessionid= ($session -split ‘ +’)[2]
logoff $sessionid
}

Event ID 20069 – AT_KEYEXCHANGE

September 15, 2020, by admin No comments yet

If you happen to get Event ID 20069 “The specified certificate could not be loaded because the KeySpec must be AT_KEYEXCHANGE” which has happened to me recently and made me spent quite a lot of time to find a reason what was going wrong.

Most of the troubleshooting articles that you will find (although they are not many) will refer to the wrong type of the certificate being used and lead to regenerate it following the certain steps. However, with Microsoft monitoring agent and “AT_KEYEXCHANGE” error might be complete a different thing, which had also been in my case. I had exact same type of certificates working on other server but not on a specific one. Read more →

SharePoint Online: Adding Term Store Administrators

June 10, 2020, by admin No comments yet

When you first start using the Term Store Management Tool in SharePoint Online, it may not be immediately obvious why you cannot initially add/modify/delete the term sets or the terms within them.

When you access the Term Store Management Tool from the Site Settings page of a site collection, you will be able to see the term sets that are provided by default and cannot be changed as shown below:

Read more →

Sharepoint Online. Get storage use per site using powershell

June 8, 2020, by admin No comments yet
Connect-SPOService -Url https://xxxxx-admin.sharepoint.com

$ODFBSites = Get-SPOSite -Limit All | Select Owner, Title, URL, StorageQuota, StorageUsageCurrent | Sort StorageUsageCurrent -Desc
 $TotalODFBGBUsed = [Math]::Round(($ODFBSites.StorageUsageCurrent | Measure-Object -Sum).Sum /1024,2)

$Report = [System.Collections.Generic.List[Object]]::new()
 ForEach ($Site in $ODFBSites) {
 $ReportLine = [PSCustomObject]@{
 Owner = $Site.Title
 Email = $Site.Owner
 URL = $Site.URL
 QuotaGB = [Math]::Round($Site.StorageQuota/1024,2)
 UsedGB = [Math]::Round($Site.StorageUsageCurrent/1024,2)
 PercentUsed = [Math]::Round(($Site.StorageUsageCurrent/$Site.StorageQuota * 100),2) }
 $Report.Add($ReportLine) }
 $Report | Export-CSV -NoTypeInformation sporeport.CSV
 Write-Host "Current OneDrive for Business storage consumption is" $TotalODFBGBUsed "GB. Report is in sporeport.CSV"

Extract IP addresses from PCAP

May 19, 2020, by admin No comments yet

Open Command prompt and go to to wireshark directory like

cd C:\Program Files\Wireshark

tshark -nr input.pcap -T fields -e ip.src -e ip.dst -E separator=, > ouput.csv

here you have to provide input.pcap file with directory and you will get output in csv format.

How to Convert Evaluation Server 2016 to Licensed Version

May 19, 2020, by admin No comments yet

1. Open PowerShell as Administrator and give the following command to find the installed version of Server 2016:

DISM /Online /Get-CurrentEdition

2. Then give the following command to convert the Server 2016 Evaluation version to Full Retail (Licensed):

To learn version available for the current image

DISM /online /Get-TargetEditions
DISM /online /Set-Edition:ServerStandard /ProductKey:XXXXX-XXXXX-XXXXX-XXXXX-XXXXX /AcceptEula

NGINX: Enable directory listing

January 27, 2017, by admin No comments yet

Enabling directory listing in a folder in nginx is simple enough with just an autoindex on; directive inside the location directive. You can also enable sitewide directory listing by putting it in the server block or even enable directory access for all sites by putting it in the http block.

An example config file:

server {
 listen 80;
 server_name domain.com www.domain.com;
 access_log /var/...........................;
 root /path/to/root;
 location / {
 index index.php index.html index.htm;
 }
 location /somedir {
 autoindex on;
 }
}

How can I get VirtualBox to run at widescreen resolution ?

November 21, 2016, by admin No comments yet

Example for 1366×768.

1. Shutdown VM
2. Navigate to C:\Program Files\Oracle\VirtualBox\
3. Shift + Right-Click > Open command window here
4. Run command VBoxManage.exe setextradata “Windows 8 RTM Evaluation” CustomVideoMode1 1366x768x32
5. Start VM
6. Launch Desktop, Right-Click > Screen Resolution
7. Choose 1366 x 768

ESXi Duplicate vmk0 MAC Addresses

June 4, 2016, by admin No comments yet

For the ICM class there are 12 different lab environments with 2 virtual ESXi host each. To deploy these ESXi hosts I clone them from a master ESXi template that is preconfigured and has a local datastore with all the necessary class files and software. After I deploy each virtual machine I test connectivity and before last nights class everything seemed fine.

To locate MAC addresses on VMware ESXi servers using command line interface:

– Enable root login for SSH/SCP clients (click for my blog on how to enable RL)
– Login to VMware ESXi via SSH
– Run the command- vim-cmd hostsvc/net/info | grep “mac =”
Now you have your list of MAC addresses. Login to VMWare vSphere client and match the MAC addresses to the Network Adapters section.

Once the class started accessing the lab environments we started seeing some network issues. Connections to the lab ESXi hosts were being dropped every few seconds, restarting the management networks would bring back connectivity but only for a short time. The issue turned out to be that each of the 24 hosts had the same MAC address assigned to vmk0 – oops!

The vmk0 is a virtual interface and a MAC address is generated for it when it is created. When the ESXi template is cloned the vmknic and its configuration (Name, MAC, MTU, and IP settings) are also cloned. Accessing ESXi Shell and running esxcfg-vmknic -l will list the configured vmknics and the configurations (including the MAC) of each.

There are 2 ways to correct this in the cloned ESXi hosts. One way is to delete and recreate the vmk interface. The other is to set the vmknics to use the hardware MAC address of their physical uplink NIC. The process for both of these options can be found in this kb article.
For the lab environment I set the vmknic MAC to follow the hardware MAC.

esxcfg-advcfg -s 1 /Net/FollowHardwareMac

After setting this and rebooting the vmknic (vmk0) now uses the MAC address of its physical uplink nic by entering this: esxcli network ip interface set -e false -i vmk0; esxcli network ip interface set -e true -i vmk0 .

Sysprep: A fatal error occurred while trying to sysprep the machine

November 14, 2014, by admin No comments yet

Workaround:

Setting HKEY_LOCAL_MACHINE\SYSTEM\Setup\Status\SysprepStatus to 7

Setting HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\SkipRearm to 1
Renaming (or deleting) C:\Windows\System32\sysprep\Panther

12

Categories

  • FreePBX
  • IIS
  • Misc
  • Nokia
  • Photoshop
  • Server 2003
  • Server 2008
  • Ubuntu advices
  • Ubuntu troubles
  • Uncategorized
  • vim
  • Windows 2003
  • Wordpress

Recent blog posts

  • Automatically Log off Disconnected User Sessions on Windows admin, September 15, 2020
  • Event ID 20069 – AT_KEYEXCHANGE admin, September 15, 2020
  • SharePoint Online: Adding Term Store Administrators admin, June 10, 2020
  • Sharepoint Online. Get storage use per site using powershell admin, June 8, 2020
  • Extract IP addresses from PCAP admin, May 19, 2020

This is widgetised area:
Footer › Column 1

This is widgetised area:
Footer › Column 2

This is widgetised area:
Footer › Column 3

Copyright © 2020 aliyev. All Rights Reserved. Cookie policy | Privacy policy