Posts

Notify via Email on user login with Public IP with Event ID 21 Using PowerShell script

Image
PowerShell script for Windows Server. This script is used for fire and Email notification on any user login via Public IP. Steps: 1. Save the script with the name EmailNotification.ps1. 2. Create a Basic Task via Task Scheduler. Enter Name for Task. 3. Select the Trigger option "When a specific event is logged" 4. Select option as below. 5. On Action Select "Start a specific program" and browse the EmailNotification.ps1 file. 6. Save the task. Script:  # Define the SMTP server details and user credentials $smtpServer = "SMTP server" # SMTP.GMAIL.COM $smtpUsername = "SMTP username" $smtpPassword = "password for authentication" $smtpSecurePassword = ConvertTo-SecureString -String $smtpPassword -AsPlainText -Force $smtpCredential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $smtpUsername, $smtpSecurePassword $from = "from@example.com" $to = "to@example.com" # Define Regex ...

Decrypt the password from RDCMan.exe using PowerShell Script.

Decrypt the password from RDCMan.exe using PowerShell Script.   The script is used for retrieving the password from RDCMan.exe. The script is only working within the profile from which the original .rdg file was generated. Because The string is encoded with the local user profile that is used to set the password in the RDG file. Therefore the string cannot be decrypted from another user account than yours.  Comments: <# 1. Rename the RDP.rdg file to RDP.xml in the original folder or you may copy it to a different location. 2. Rename the RDCMan.exe to RDCMan.dll in the C:\Temp folder in the original folder or you may copy it to a different location. #>  Import-Module 'Path\to\RDCMan.dll'  $EncryptionSettings = New-Object -TypeName RdcMan.EncryptionSettings  $xml = [xml](Get-Content "Path\to\RDP.xml") # Path to RDP.xml file.  $passwords = Select-Xml -Xml $xml -XPath "//password"  $usernames = Select-Xml -Xml $xml -XPath "//userName"  forea...

How to Enable Recycle Bin on Mapped drive.

Image
How to Enable Recycle Bin on Mapped Drive. Here is the solution for enabling Recycle Bin on Mapped Drive. I have tested it in My existing environment Windows Server 2019 and Windows Server 2012 and it's running fine.  Step 1. Press Win+R and type regedit and hit the enter key. Step 2. Goto " HKLM\Software\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions " Step 3. Press Right Click on Mouse and Create New Key under FolderDescriptions and paste  " {9147E464-33A6-48E2-A3C9-361EFD417DEF} " as value. Step 4. After creating the key Right Click under  " {9147E464-33A6-48E2-A3C9-361EFD417DEF} " and Create New REG_DWORD-32Bit with Name = Category and set Value to 4. Step 5. Create New String with Name = RelativePath and set the value to Y:\  (Note: Replace volume letter Y with your existing letter. ) Step 6.  Create New String with Name = Name  and set the  value to YDrive Step 7. Goto " HKCU\Software\Microsoft\Windows\CurrentVersion\Exp...

How to Use Slmgr to Change, Remove, or Extend Your Windows License

Image
  How to Use Slmgr to Change, Remove, or Extend Your Windows License Windows activation is designed to be as foolproof as possible, so Microsoft’s graphical tools keep it simple. If you want to do something more advanced like remove a product key, force an online activation, or extend the activation timer, you’ll need Slmgr.vbs. This command-line tool is included with Windows and provides options unavailable in the standard activation interface provided on the Update & Security > Activation screen in the Settings app. First: Open an Administrator Command Prompt Window To use this tool, you’ll want to launch a Command Prompt with Administrator access. To do so on Windows 8 or 10, either right-click the Start button or press Windows+X. Click the “Command Prompt (Admin)” option in the menu that appears. On Windows 7, search the Start menu for “Command Prompt,” right-click it, and select “Run as Administrator.” Note : If you see PowerShell instead of Com...

How to Back Up and Restore NTFS and Share Permissions

Image
How to Back Up and Restore NTFS and Share Permissions                One thing that has made the NTFS permissions piece of this simpler is the  Icacls   tool. Icacls was developed for Windows Vista as a replacement for tools such as  Calls ,  Xcacls , and  Xcacls.vbs . It was also included in Service Pack 2 for Windows Server 2003 and Windows Server 2008. Backup and Restore of Share Permissions To backup share permissions, export the  Shares  registry key. Open  Regedit  to the following location: HKLM\SYSTEM\CurrentControlSet\Services\LanmanServer\Shares Right-click the  Shares  registry key and select  Export . Give it a file name such as  shareperms.reg . When you want to restore the permissions, double-click  shareperms.reg  to import it back into the registry. Use the  Reg    tool to backup the registry key from ...

How to disable Network Authentication in Windows Server 2016 with Group Policy.

Image
How to disable Network Authentication in Windows Server 2016 with Group Policy. Configure policies on Terminal Server: Open gpedit.msc applet. Navigate to Computer Configuration -> Administrative Templates -> Windows Components -> Remote Desktop Services -> Remote Desktop Session Host -> Security . Enable: Require use of specific security layer for remote (RDP) connections and select RDP as Security Layer. Disable: Require user authentication for remote connections by using Network Level Authentication policy. Reboot Terminal server.

How to delete 0.0.0.0 Gateway.

How to delete 0.0.0.0 Gateway. Open a command prompt. Win+R -> cmd and hit enter. Type “ route delete 0.0.0.0 ”. Configure the IP settings to add back your correct default gateway IP address.