Windows DHCP import/export


Export:

On the Windows 2003 DHCP server, navigate to a command prompt

Type the following Command: netsh

Type the following Command: DHCP

Type the following Command: server \\Name or IP Address

Type the following Command: export c:\DHCPdb all


Import:

Type the following Command: netsh

Type the following Command: DHCP

Type the following Command: server \\Name or IP Address

Type the following Command: import c:\DHCPdb

Close the command prompt when completed.

Return to DHCP located in the Server Manager dashboard.

Right click the designated DHCP server in the services pane, then select Restart.

Once the DHCP install has been completed, select DHCP located in the Server Manager dashboard

Right click the designated DHCP server in the services pane, then select Stop.

Delete the DHCP.mdb file under c:\windows\system32\DHCP folder.

Return to DHCP located in the Server Manager dashboard

Right click the designated DHCP server in the services pane, then select Start.


source:  https://docs.microsoft.com/en-us/archive/blogs/canitpro/step-by-step-migration-of-dhcp-from-windows-server-2003-to-windows-server-2012

ESXI enalbe SNMP

 Run through ssh (it's  all in one line)

esxcli system snmp set -r && esxcli system snmp set -c COMMUNITY && esxcli system snmp set -p 161 && esxcli system snmp set -C CONTACTA_MAIL && esxcli system snmp set -L "LOCATION" && esxcli system snmp set -e yes
 

Virtualbox expand disk size


Run vboxmanage.exe (c:\program files\oracle\virtualbox).
To expand disk to 50gb:
vboxmanage.exe modifyhd path_to_vdi --resize 50000

ex:
vboxmanage.exe modifyhd d:\vms\win7teste.vdi --resize 50000

Then use a live cd with partition tools, like gparted to resize disk partitions (gparted.sourceforge.net/download.php)


Mysql shell script without password exposure

Suppose your username is "db_user". Running from the shell prompt:

mysql_config_editor set --login-path=local --host=localhost --user=db_user --password

It prompts for the password. Once you enter it, the user/pass are saved encrypted in your home/system_username/.mylogin.cnf

write the password between "" if contains spacial character, like "#" or "." ex: "Passw#rd"

Of course, change "system_username" to your username on the server.

Change your bash script from this:

mysqldump -u db_user -pInsecurePassword my_database | gzip > db_backup.tar.gz

to this:

mysqldump --login-path=local my_database | gzip > db_backup.tar.gz


mysql --login-path=local -D DATABASE -e "SELECT * FROM table LIMIT 10"

MS SQLServer clear log file


ALTER DATABASE <database_name>
SET RECOVERY SIMPLE
GO
DBCC SHRINKFILE (<log_file_name>, 1)
GO
ALTER DATABASE <database_name>
SET RECOVERY FULL


Add new disc linux host vmware


Scan all existing hosts with a one-liner:

for host in /sys/class/scsi_host/*; do echo "- - -" | sudo tee $host/scan; ls /dev/sd* ; done


fdisk /dev/sdb
m to menu
n to new partition
w to write

mkfs.ext4 /dev/sdb1 to format

Resize disc: 

To make the kernel aware, one can issue the following command as root:

echo 1 > /sys/class/block/sdb/device/rescan
parted /dev/sdb
print
resizepart 1 
quit parted
sudo partprobe 
 
Resize File system 
umount /dev/block_device
e2fsck -f /dev/block_device
resize2fs /dev/block_device
 
 
 
 

ESXi enable remote syslog

  esxcli system syslog config set --loghost=udp://10.20.0.27:514 esxcli network firewall ruleset set --ruleset-id=syslog --enabled=true  esx...

Mais vistos