Author Archives: NesiSamurai

EXCEL: How to get number from any position in a string

Copy pasting as found on another website for future reference. (Link to website)

If your task implies extracting number from anywhere in a string, you can make use of the following mind-boggling formula published on MrExcel forum:

=SUMPRODUCT(MID(0&A2, LARGE(INDEX(ISNUMBER(--MID(A2, ROW(INDIRECT("1:"&LEN(A2))), 1)) * ROW(INDIRECT("1:"&LEN(A2))), 0), ROW(INDIRECT("1:"&LEN(A2))))+1, 1) * 10^ROW(INDIRECT("1:"&LEN(A2)))/10)

Where A2 is the original text string.

Breaking down this formula would require a separate article, so you can simply copy it to your worksheet to make sure it really works 🙂
Formula to get number from any position in a string

Upon examining the results, however, you may notice one insignificant drawback – if the source string does not contain a number, the formula returns zero, as in row 6 in the screenshot above. To fix this, you can wrap the formula in the IF statement, the logical test of which checks if the source string contains any number. If it does, the formula extracts the number, otherwise returns an empty string:

=IF(SUM(LEN(A2)-LEN(SUBSTITUTE(A2, {"0","1","2","3","4","5","6","7","8","9"}, "")))>0, SUMPRODUCT(MID(0&A2, LARGE(INDEX(ISNUMBER(--MID(A2,ROW(INDIRECT("$1:$"&LEN(A2))),1))* ROW(INDIRECT("$1:$"&LEN(A2))),0), ROW(INDIRECT("$1:$"&LEN(A2))))+1,1) * 10^ROW(INDIRECT("$1:$"&LEN(A2)))/10),"")

As shown in the screenshot below, the improved formula works beautifully (kudos to Alex, our Excel guru, for this improvement):

An improved formula to extract number from anywhere in a string

Unlike in all previous examples, the result of this formula is number. To make sure of this, just notice the right-aligned values in column B and truncated leading zeros.


Leave a comment

Posted by on May 29, 2021 in Uncategorized


HP Server Windows 2019 ROK bios lock error [Solution]

This error happened when I tried to install Win server 2019 ROK on an HP server(vmware esxi). This happens when the vm does not see the motherboard.

Solution: Download the vmx file for your vm. add the following line and then upload. thats all.

SMBIOS.reflectHost= "TRUE"
Leave a comment

Posted by on May 19, 2021 in Windows


Zkteco F18 with ElectricLock+PushButton

In this diagram you can see how to install Zkteco F18 with Door lock and push button.

  • Connect NC (Yellow) of F18 to +ve (Red) on Door Lock.
  • Connect COM(Red) and +ve(Red) of F18 to +ve of the power supply (12v 3A)
  • Connect both the -ve (Black) of F18 and -ve (Black) of Door Lock to -ve of Power supply.
  • Connect BUTTON (Grey) of F18 to 1 of the connections in Push button.
  • Connect the other connection on the button to -ve of Power supply.
Leave a comment

Posted by on April 25, 2021 in Uncategorized


Disable USB mass storage access on client machines

  1. Go to the client machine and
  2. go to start button and type in to search box gpedit.msc
  3. then your group policy window will open
  4. left side of window – search Administrative Templates and double click on it
  5. then click on System
  6. next you will see Removable Storage Access just click on it
  7. then you will see lots of group policy name
  8. see the All Removable Storage Access: Deny All Access
  9. double click on it and select the option Enable and click on OK button
  10. you will success to block USB of client

Then from cmd run ==> gpupdate /force

Leave a comment

Posted by on January 30, 2021 in Uncategorized


Open sections of Control Panel from CMD

  • Accessibility Options control windows+R > access.cpl
  • System properties, Add domain, change name windows + R > sysdm.cpl
  • Add/Remove Programs windows + R > appwiz.cpl
  • Display Properties windows+R> desk.cpl
  • Date/Time Properties w+R> timedate.cpl
  • Fonts Folder WQ+R> fonts
  • Network properties W+R > ncpa.cpl
  • Regional Settings control intl.cpl

Internet Properties            windows+R > inetcpl.cpl
Joystick Properties            windows+R > joy.cpl
Keyboard Properties            windows+R > main.cpl keyboard
Microsoft Exchange             windows+R > mlcfg32.cpl
   (or Windows Messaging)
Microsoft Mail Post Office     windows+R > wgpocpl.cpl
Modem Properties               windows+R > modem.cpl
Mouse Properties               windows+R > main.cpl
Multimedia Properties          windows+R > mmsys.cpl
Network Properties             windows+R > netcpl.cpl
                               NOTE: In Windows NT 4.0, Network
                               properties is Ncpa.cpl, not Netcpl.cpl
Password Properties            control password.cpl
PC Card                        control main.cpl pc card (PCMCIA)
Power Management (Windows 95)  control main.cpl power
Power Management (Windows 98)  control powercfg.cpl
Printers Folder                control printers

Scanners and Cameras           control sticpl.cpl
Sound Properties               control mmsys.cpl sounds
System Properties              control sysdm.cpl
Leave a comment

Posted by on January 30, 2021 in Windows


Virtualenv in PowerShell for python

Today I was following a tutorial about Flask for python. While doing this I ran into a problem. I created a folder for my project. Then installed virtual environment module.

pip install virtual env 

ran successfully, module virualenv is now installed

virtualenv env 

this command also ran successfully. a virtual environment with name env is created.

so we have created a virtual environment. now to activate we need to run a batch file form inside the env folder.


This will not run in power-shell because its a batch file.

so I tried the next option.


this gave an error.

.\env\Scripts\activate.ps1 : File D:\Userfiles\Desktop\Py Flask\env\Scripts\activate.ps1 cannot be loaded because running scripts is disabled on this system. For more
information, see about_Execution_Policies at https:/

so how to activate our virtual environment?

lets remove the restriction.

 Set-ExecutionPolicy -Scope CurrentUser RemoteSigned 

the above command will enable running scripts for current user. we can disable this with the following command after we finish.

Set-ExecutionPolicy -Scope CurrentUser Restricted

running scripts is now enabled. lets try again.,with


It works! yay..

Leave a comment

Posted by on January 25, 2021 in Python


Tags: , , ,

Website hosting and iPage

In this post I will write down how to host a website at iPage and route a domain from to the hosting.

  • add an A record in pointing to iPage hosting server IP.
  • in iPage go to Domains ==> import domain
  • on the next screen select add existing domain. (Add your domain but keep your current registrar.)

no we if someone opens your domain, DNS will point to A record. Thus traffic is forwarded to iPage hosting. Now traffic reaches the server, but we need to route the traffic to the website directory. To do this we need to add a pointer in our hosting. But by default this option is not shown on our dashboard.

All domains you added to your iPage hosting will be listed here, select the domain you want to add the pointer.

You will see these options. Select pointers.

Select Subdirectory ==> /folder_where_your_website_files_are_stored.

Now the traffic is routed to your website directory.

You need to change any domain reference in your website files. for example if you are using a wordpress template, inside wp-admin you may have assigned a domain URL, when you change the domain maping on iPage you must also change the same inside your code as well.

How do I change the WordPress Site URL?

Leave a comment

Posted by on January 19, 2021 in Uncategorized


Messages sent from a shared mailbox aren’t saved to the Sent Items folder of the shared mailbox in Outlook

Copy pasted for future reference from Microsoft docs website.

Assume that you’re using Microsoft Outlook 2010 or a later version, and you’ve been delegated permission to send email messages as another user or on behalf of another user from a shared mailbox. However, when you send a message as another user or on behalf of the user, the sent message isn’t saved to the Sent Items folder of the shared mailbox. Instead, it’s saved to the Sent Items folder of your mailbox.

In Office 365, shared mailboxes don’t require a license and can’t be added to Outlook as an independent mailbox. You can’t sign in to a shared mailbox. Instead, you sign in to your own mailbox, and then you open the shared mailbox. When you send or reply to a new message from the shared mailbox, Outlook automatically sends or replies from the sender’s account. Therefore, messages are stored in the Sent Items folder of the sender’s mailbox.

Method 1: Configure the mailbox to save a copy of the message to the Sent Items folder of the shared mailbox in Exchange Online or in on-premises Exchange Server

Exchange Online in Office 365 or Exchange Server 2013 Cumulative Update 9 or later update

Cumulative Update 9 for Exchange Server 2013 introduced a new feature that lets administrators configure the Sent Items folder to which a message is copied. For more information, see Exchange Blog – Want more control over Sent Items when using shared mailboxes?

Using Exchange PowerShell, for emails Sent As the shared mailbox, run the following cmdlet:PowerShellCopy

set-mailbox <mailbox name> -MessageCopyForSentAsEnabled $True

Using Exchange PowerShell, for emails Sent On Behalf of the shared mailbox, run the following cmdlet:PowerShellCopy

set-mailbox <mailbox name> -MessageCopyForSendOnBehalfEnabled $True

Exchange Server 2010 Service Pack 2 Update Rollup 4 or later update

Update Rollup 4 for Exchange Server 2010 Service Pack 2 introduced a new Exchange PowerShell cmdlet to configure the Sent Items folder to which a message is copied. Because this new feature is handled by the server that’s running Exchange Server, Outlook can be configured in online mode or cached Exchange mode. However, this feature works only if the Outlook DelegateSentItemsStyleregistry (Method 2 below) value is disabled.

For more information about the Set-MailboxSentItemsConfiguration cmdlet, see the following Microsoft Knowledge Base article:

2632409 Messages sent by using the “Send As” and “Send on behalf” permissions are only copied to the Sent Items folder of the sender in an Exchange Server 2010 environment


The MessageCopyForSentAsEnabled and MessageCopyForSendOnBehalfEnabled settings are not supported if the user mailbox and shared mailbox are located in different environments (cloud and on-premises). The settings are supported only if both mailboxes are in the same environment (cloud or on-premises).

Method 2: Set the DelegateSentItemsStyle registry value on the Outlook client


Outlook must be configured to run in cached mode for this option to work correctly. For more information, see the following Microsoft Knowledge Base article:

2703723 Email remains in the Outbox when you use the DelegateSentItemsStyle registry value

If you’re running Outlook 2010, install the Outlook 2010 hotfix package that’s dated December 14, 2010. Then, follow these steps.

For more information about this hotfix package, see the following Microsoft Knowledge Base article:

2459115 Description of the Outlook 2010 hotfix package (outlook-x-none.msp): December 14, 2010


If you’re running Outlook 2013 or a later version, you don’t have to install any hotfix.

  1. Click Start, click Run, type regedit, and then click OK.
  2. Locate and then click the following registry subkey:HKEY_CURRENT_USER\Software\Microsoft\Office\x.0\Outlook\Preferences NoteThe x.0 placeholder represents your version of Office (16.0 = Office 2016, 15.0 = Office 2013, 14.0 = Office 2010).
  3. On the Edit menu, point to New, and then click DWORD Value.
  4. Type DelegateSentItemsStyle, and then press Enter.
  5. Right-click DelegateSentItemsStyle, and then click Modify.
  6. In the Value data box, type 1, and then click OK.
  7. Exit Registry Editor.

Leave a comment

Posted by on January 12, 2021 in Windows


enable darkmode on windows 10 trial


Create new directory under themes “Personalize”
add a new dword(32)
set the value to zero

Open personalize directory if present
change the value of the dword – AppUseLightTheme
set the value to zero. by default it will be zero.

Leave a comment

Posted by on January 12, 2021 in Windows


Fortigate 40C Format and upgrade firmware via CLI

To format and upgrade a firmware on Fortigate 40C, We will need 3 types of cables.


1. Connect console cable to console port of the Fortigate.
Use a serial to USB converter and connect to a USB on your laptop.
2. Connect USB cable (same cable we use with printers) to mng port of the fortigate.
3. Connect ethernet cable to port 5 (This port is special i think).
connect other end to your laptop.

Now all connections are in place.

Give your laptop an IP (manually): – – no need for Gateway
( you can use any IP, but i suggest to use this.)

Install 3 softwares,
1. Putty (link)
2. tftpd32 (link)
3. fortiexplorer (link)

if you have a Config backup, open it with a text editor.

You will see the build number and version of the firmware for that specific config file.
Download the firmware from FortiNet website.

For ease of use we can put all these files in a folder:
(in my case C:\Users\MyName\Desktop\Fortigate_40c_Format)

make a copy of the firmware file,
Rename the firmware file to image.out

Open TFTPD32.
Set the interface to the one to which we gave the IP
Set the root directory by clicking “Browse” on the tftp server window, and select
the folder with our files.
(in my case C:\Users\MyName\Desktop\Fortigate_40c_Format)


Open putty.
Set connection type to serial. and enter the COM port.
serial connection properties:
8 bits
no parity
1 stop bit
9600 baud (For a FortiGate-300, use 115,000 baud.)

You can find the COM port number from:
Right-click-Computer > Manage > Devices >
This will list all COM ports. Note the number for USB-Serial-connection. in my case it was COM4.

Now click connect on Putty.
Turn the power off and then on at the FortiGate unit.

Stuff will start to pop up on the console screen.
When the console displays

“Press any key to display configuration menu.”
Press any key.

[G]: Get firmware image from TFTP server.
[F]: Format boot device.
[B]: Boot with backup firmware and set as default.
[Q]: Quit menu and continue to boot with default firmware.
[H]: Display this list of options.

Enter G,F,B,Q,or H:

these opetions will come.
Select F for now to format the boot device.

[note: Some console prompts in this procedure include a default value in square brackets, e.g., [image.out]. To use this default value, just press Enter.]

When format is finished, device will restart.
Do the same. When you reach this options. This time select G.
“Get firmware image from TFTP server.”

it will ask for IP of TFTP server. if you gave the same IP as above just click enter.
"Enter TFTP server address []: "
(if you gave another IP to your laptop, type the ip at the prompt
example: "Enter TFTP server address []:")

now the console will ask for IP of the fortigate. enter to proceed with default value.
"Enter local address []: "

Now give the name of the firmware file.
Enter firmware image file name [image.out]:
(since we renamed our file to image.out we can just press enter)

The Fortigate downloads the firmware from the TFTP server and displays a message similar to the following:

MAC:001122B15D94 (MAC of your laptop)
########################### (transfer progress)
Total 28385179 bytes data downloaded.(firmware file size)
Verifying the integrity of the firmware image.. (verification stage)

Save as Default firmware/Backup firmware/Run image without saving:[D/B/R]?
type D to make load the firmware as the default firmware.

(if the download fails after the integrity check with the error message:
invalid compressed format (err=1) )

The fortigate downloads the firmware from the TFTP server.
Then installs the firmware and restarts.
The time required varies by the size of the file and the speed of your network connection.

Now we have installed the firmware.

Open the FortiExplorer software. this will detect the connected device (through mng USB cable)

Select web GUI from the given options.
Login with default password.
Username: admin
Password: (blank)

if you can login and the window is loading fine. You can restore your config file through the GUI.
this app gives you non IP dependend connection to the device. (Console acces otherwise called out of bound access).

In my experience I found that the app is slow for real stuff. So this is what I did.
There is an option to do basic configuration through a wizard. select this and set IP, username, and password etc. Basic stuff no need to care much, we will replace this config in coming steps.

when finished. make sure the IP of your laptop and fortigate are on the same subnet.

Open a browser window and type in the IP address of the device.
Login with your username and password. (the one we set above)

In the main window (dashboard) you will see option to restore a configuration.
selct ‘restore’, then choose the Backup config file. then click restore.
Fortigate will apply the configuration and restart.

You can see these happening on your console window. (just watch don’t type anything)
then it will say firewall is initialising…

you can do another thing. ping to to the fortigate IP with the -t operator.

Ping -t
wait until you start getting results for the ping.

Open the web browser window.
if the IP you gave when setting basic config through the wizard and the IP in your config files are different,
after the upgrade you need to use the IP in your config file.

login with your old username and password (from the backup config).
The username and password are the ones you used while you had the old configuration.

thats it.
Now you have formated the device.
installed a firmware.
loaded a backup configuration.

Now register your device through the portal to activare your forticare licences.

Leave a comment

Posted by on January 12, 2021 in Fortigate