RSS

Author Archives: NesiSamurai

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.

env\Scripts\activate.bat

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

so I tried the next option.

 env\Scripts\activate.ps1 

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:/go.microsoft.com/fwlink/?LinkID=135170.

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

.\env\Scripts\activate.ps1

It works! yay..

 
Leave a comment

Posted by on January 25, 2021 in Python

 

Tags: , , ,

Website hosting Name.com and iPage

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

  • add an A record in name.com 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 name.com 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.

Problem
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.

Cause
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

 Note

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

 Note

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

 Note

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

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes

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

HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes
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.

Next:
Give your laptop an IP (manually):
192.168.1.168 – 255.255.255.0 – 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 192.168.1.168
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)

Next..

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 [192.168.1.168]: "
(if you gave another IP to your laptop, type the ip at the prompt
example: "Enter TFTP server address [192.168.1.168]:192.168.1.25")

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

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

 

Office 365 Shared Mailbox – Deleting User

When we need to delete a user in Microsoft 365, There is an option to make the mailbox into a shared mailbox. You will not be able to login to that mailbox anymore, instead after converting the user mailbox to a shared mailbox, you can delegate another user with permission to that shared mail box.

optional step: When we delete a mailbox, by default the alias of that mailbox is deleted. If you want to delete the email address of the user (ie., username@domain.com) we need to change the current mail address to an alias. And make the current Microsoft default alias (username@domain.onmicrosoft.com) as the primary email.
select user==> account tab ==> click on “manage username and email” ==> under aliases click on the 3dot menu ==> select “change to primary email” (this will make Microsoft default alias to primary email address).

To delete a user:

  1. select user from active users list ==> click on delete
  2. Tick “email aliases will be removed”
  3. Tick “Give another user access to access to <user>’s email.”
  4. click on “required:Give email access to another user”
  5. Assign another user to the mailbox.
  6. Click on Delete user.
  7. Select create a new display name , and set a Display name for the shared mailbox.
  8. if you don’t want to send automatic replies. Untick send automatic replies dialogue.
  9. Click on transfer ownership.
  10. click on assign and convert.

 
Leave a comment

Posted by on January 12, 2021 in Windows

 

Change numbers to Arabic in excel.

  1. Select the area of the cells that you need to change
  2. Press Ctrl+1 using keybard
  3. Go to Customes and type this code: [$-2000000]#,##0.00
  4. This will give you comma seperate and 2 decimals

[$-2000000]#,##0.00 this will make numbers separated by comma and 2 decimal points.

[$-2000000]0 this will just convert the numbers to Arabic. No decimal and no commas.

 
Leave a comment

Posted by on January 10, 2021 in Windows

 

Create VLAN in fortigate 30D

By default all ports are members of a hardware switch. remove one of the port from the switch. for example port 4. Now we will create our VLANs under this port.

fgt#config system interface
fgt(interface)#edit <vlan-name>#if vlan-name not exist, vlan will be created.
fgt(<vlan-name>)#set interface lan4 #assign this vlan to the lan4 port.
fgt(<vlan-name>)#set ip <give an ip in vlan range/24>#set ip for the vlan port
fgt(<vlan-name>)#set vlanid <id># set VLAN ID
fgt(<vlan-name>)#next
fgt(<vlan-name>)#end
#Vlan ID and Name are not same,eg. Vlan-Name = Wireless, VlanID= 70
 
Leave a comment

Posted by on January 5, 2021 in Fortigate