How to convert an executable to a Windows service
To create a Windows service from an executable (.exe), you need to use the sc.exe program (already included in Windows):
sc.exe create <new_service_name> binPath= "<path_to_the_service_executable>"
You must put quotes “” at the beginning and end of the path and a space after binPath=.
Example:
sc create IperiusBackup start= auto binPath= "C:\Program Files (x86)\Iperius Backup\IperiusService.exe" DisplayName= IperiusBackup
This freeware can also be used: http://nssm.cc/
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
Mysql shell script without password exposure
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
Corrigir erro NATS no Segura
### erro Nats orbit nats stop orbit nats setup orbit services reload orbit services restart all ls -lh /var/orbini/system/incdt/
Mais vistos
-
Find Users Who Have Never Logged On Use the following PowerShell Command; Get-ADUser -Filter { LastLogonDate -notlike "*" -and En...
-
Java Keytool Command These commands allow you to generate a new Java Keytool keystore file, create a CSR, and import certificates. A...
-
First you have to configure a wpad site in your IIS Open the proxypac.pac file you have previously created and save as wpad.dat. Copy wpa...