Skip to content

Instantly share code, notes, and snippets.

@jamil666
jamil666 / UserLastLogonInfo_in_Database
Created March 16, 2020 10:01
Needed modules: PSSQlite, Quest Active Directory
Import-Module PSSQLite
Add-PSSnapin Quest.ActiveRoles.ADManagement
# Database path
$Database = "C:\report\UsersLastLogon.SQLite"
$Query = "CREATE TABLE IF NOT EXISTS UsersLastLogon (
Username TEXT,
Computername TEXT,
LastLogon TEXT)"
@jamil666
jamil666 / Py2EXE
Created February 26, 2020 13:36
Convert Python to EXE file
from PyQt5 import QtCore, QtGui, QtWidgets
import os
class Ui_MainForm(object):
# Select Python file
def open_python_file(self):
directory = QtWidgets.QFileDialog.getOpenFileName(directory="C:\\", filter="*.py")
self.InputFile.setText(directory[0])
from pyVim.connect import SmartConnect, SmartConnectNoSSL, Disconnect
from pyVmomi import vim
import re, ssl
vc = 'Vcenter name'
username = 'username'
password = 'password'
pg = input('New network name: ') # Port Group name in Vcenter
vlan_id = input('New vlan ID: ') # Vlan ID
esx_host = ['esxi1', 'esxi2'] # List of ESXi hosts
@jamil666
jamil666 / User Lockout Source
Created December 3, 2019 09:28
Powershell script for finding user lockout source
## Define the username that’s locked out
$Username = Read-Host "Please enter username: "
## Find the domain controller PDCe role
$Pdce = (Get-AdDomain).PDCEmulator
# Check if user locked out
$LocketOutStatus = Get-ADUser -Properties LockedOut -Identity $Username | select LockedOut
if ($LocketOutStatus.LockedOut -eq 'True'){
import requests
from hpe3parclient import client, exceptions
username = 'username'
password = 'password'
# Storage IP
ip_address = 'IP'
Storage = 'Storage Name'
@jamil666
jamil666 / CBAR currency
Created August 6, 2019 09:06
Parsing cbar.az currency and make dictionary with current values
import requests
from bs4 import BeautifulSoup
URL = 'https://www.cbar.az/currency/rates'
response = requests.get(URL)
soup = BeautifulSoup(response.content, 'html.parser')
codes = []
values = []
@jamil666
jamil666 / gist:dbb9ec6be4f051b53439f2a5e0cb1123
Created December 24, 2018 13:26
Switches temperature monitoring (HP Procurve)
import paramiko
import smtplib
from email.mime.text import MIMEText
import time, datetime
date = datetime.datetime.now()
currentDate = date.strftime("%d %B %Y %I:%M%p")
# Mail sender function
def SendMail(alert):
import paramiko
import smtplib
from email.mime.text import MIMEText
import time, datetime
date = datetime.datetime.now()
currentDate = date.strftime("%d %B %Y %I:%M%p")
# Mail sender function
def SendMail(alert):
@jamil666
jamil666 / Windows_WMI_Monitoring
Created January 29, 2018 09:11
Windows_WMI_Monitoring
import wmi
from socket import *
import smtplib
from email.mime.text import MIMEText
def SendMail(alert):
# Define to/from
sender = 'Your sender email'
recipient = 'Your recipient email'
@jamil666
jamil666 / CPU_RAM_Disk_Monitoring
Last active September 30, 2023 07:42
CPU_RAM_Disk_Monitoring
import psutil
import smtplib
from email.mime.text import MIMEText
from socket import *
def SendMail(alert):
# Define to/from
sender = 'Your sender email'
recipient = 'Your recipient email'