Remove old computers from AD
dsquery computer -inactive 6 -limit 0 | dsrm
Where 6 is the number of weeks without login.
dsrm "CN=computername,CN=computers,DC=domainname,DC=local"
Remove only one computer
Prevent updating of a specific package
dpkg
Put a package on hold:echo "<package-name> hold" | sudo dpkg --set-selections
Remove the hold:echo "<package-name> install" | sudo dpkg --set-selections
Display the status of your packages:
dpkg --get-selections
Display the status of a single package:
dpkg --get-selections | grep "<package-name>"
apt
Hold a package:sudo apt-mark hold <package-name>
Remove the hold:
sudo apt-mark unhold <package-name>
Remove half-installed packages
APT remove half-installed packages
mv /var/lib/dpkg/info/PACKAGE.* /tmp/
dpkg --remove --force-remove-reinstreq PACKAGE
apt-clean
apt update
Allow relay ASSP
Network Setup, Limits and DKIM signing for Relaying, Outgoing and Local Mail relaying not allowed
acceptAllMail: 10.20.0.211|10.20.0.213|10.20.0.45|10.20.15.|10.20.0.
Apply Changes
Zimbra export account command line
Export full backup of one zimbra account
zmmailbox -z -m user@domain -t 0 getRestURL "//?fmt=tgz" > /tmp/user@domain.tgz
Export current day backup of one zimbra account*
zmmailbox -z -m user@domain -t 0 getRestURL --startTime $(date -d '-1 day' +%Y/%m/%d) --endTime $(date -d '+1 day' +%Y/%m/%d) "//?fmt=tgz" > /tmp/user@domian.tgz
Export last 7 days backup of one zimbra account*
zmmailbox -z -m user@domain -t 0 getRestURL --startTime $(date -d '-8 day' +%Y/%m/%d) --endTime $(date -d '+1 day' +%Y/%m/%d) "//?fmt=tgz" > /tmp/user@domain.tgz
Export current month backup of one zimbra account*
zmmailbox -z -m user@domain -t 0 getRestURL --startTime $(date -d "-$(date +%d) days -0 month" +%Y/%m/%d) --endTime $(date -d "-$(date +%d) days +1 month +1 day" +%Y/%m/%d) "//?fmt=tgz" > /tmp/user@domain.tgz
Export previous month backup of one zimbra account*
zmmailbox -z -m user@domain -t 0 getRestURL --startTime $(date -d "-$(date +%d) days -1 month" +%Y/%m/%d) --endTime $(date -d "-$(date +%d) days -0 month +1 day" +%Y/%m/%d) "//?fmt=tgz" > /tmp/user@domain.tgz
Import zimbra backup of one account
zmmailbox -z -m user@domain -t 0 postRestURL "//?fmt=tgz&resolve=skip" /tmp/user@domain.tgz
*Set more 1 day on the start and end date because it is not possible to specify the time on the dates
The resolve=paramater has several options:
“skip” ignores duplicates of old items, it’s also the default conflict-resolution
“reset” will delete the old subfolder (or entire mailbox if /)
“modify” changes old items
“replace” will delete and re-enter them
Export LDAP configuration zimbra
/opt/zimbra/openldap/sbin/slapcat -F /opt/zimbra/data/ldap/config -b "" -l /tmp/zimbra-ldap.ldif
zmmailbox -z -m user@domain -t 0 getRestURL "//?fmt=tgz" > /tmp/user@domain.tgz
Export current day backup of one zimbra account*
zmmailbox -z -m user@domain -t 0 getRestURL --startTime $(date -d '-1 day' +%Y/%m/%d) --endTime $(date -d '+1 day' +%Y/%m/%d) "//?fmt=tgz" > /tmp/user@domian.tgz
Export last 7 days backup of one zimbra account*
zmmailbox -z -m user@domain -t 0 getRestURL --startTime $(date -d '-8 day' +%Y/%m/%d) --endTime $(date -d '+1 day' +%Y/%m/%d) "//?fmt=tgz" > /tmp/user@domain.tgz
Export current month backup of one zimbra account*
zmmailbox -z -m user@domain -t 0 getRestURL --startTime $(date -d "-$(date +%d) days -0 month" +%Y/%m/%d) --endTime $(date -d "-$(date +%d) days +1 month +1 day" +%Y/%m/%d) "//?fmt=tgz" > /tmp/user@domain.tgz
Export previous month backup of one zimbra account*
zmmailbox -z -m user@domain -t 0 getRestURL --startTime $(date -d "-$(date +%d) days -1 month" +%Y/%m/%d) --endTime $(date -d "-$(date +%d) days -0 month +1 day" +%Y/%m/%d) "//?fmt=tgz" > /tmp/user@domain.tgz
Import zimbra backup of one account
zmmailbox -z -m user@domain -t 0 postRestURL "//?fmt=tgz&resolve=skip" /tmp/user@domain.tgz
*Set more 1 day on the start and end date because it is not possible to specify the time on the dates
The resolve=paramater has several options:
“skip” ignores duplicates of old items, it’s also the default conflict-resolution
“reset” will delete the old subfolder (or entire mailbox if /)
“modify” changes old items
“replace” will delete and re-enter them
Export LDAP configuration zimbra
/opt/zimbra/openldap/sbin/slapcat -F /opt/zimbra/data/ldap/config -b "" -l /tmp/zimbra-ldap.ldif
Enable/disable windows firewall
Win XP
(desativar FW) netsh firewall set opmode disable
(habilitar FW) netsh firewall set opmode enable
Win 7
(desativar FW) netsh advfirewall set allprofiles state off
(habilitar FW) netsh advfirewall set allprofiles state on
(parar serviço FW) net stop MpsSvc
(iniciar serviço FW) net start MpsSvc
* Para executar remoto, utilize PSEXEC.EXE ou envie um .BAT com os comandos para o usuário.
(desativar FW) netsh firewall set opmode disable
(habilitar FW) netsh firewall set opmode enable
Win 7
(desativar FW) netsh advfirewall set allprofiles state off
(habilitar FW) netsh advfirewall set allprofiles state on
(parar serviço FW) net stop MpsSvc
(iniciar serviço FW) net start MpsSvc
* Para executar remoto, utilize PSEXEC.EXE ou envie um .BAT com os comandos para o usuário.
Disable AD users with script
@echo off
setlocal
for /f “eol=; tokens=1,* delims=;” %%i in (desabilitados.csv) do (
set user=%%i
call :segue
)
endlocal
:segue
dsquery user -samid %user% | dsmod user -disabled yes
dsquery user -samid %user% | dsmove -newparent “OU=Desabilitados,DC=teste,DC=interno”
setlocal
for /f “eol=; tokens=1,* delims=;” %%i in (desabilitados.csv) do (
set user=%%i
call :segue
)
endlocal
:segue
dsquery user -samid %user% | dsmod user -disabled yes
dsquery user -samid %user% | dsmove -newparent “OU=Desabilitados,DC=teste,DC=interno”
Create event in windows log
EVENTCREATE /T WARNING /ID 199 /L APPLICATION /D “Event test”
* Event ID between 1 and 1000
Windows usefulls commands
Lista os grupos a qual um usuário é membro
fmember /list USER
Lista os DHCP autorizados no AD
netsh dhcp show server
Compara o conteúdo entre arquivos
fc file1 file2
Exibe informações importantes, como:
Data de instalação do SO, tempo de inicialização do Sistema, KBs instalados, placas de rede, domínio, servidor de logon (DC autenticado), etc…
systeminfo
Lista credenciais salvas (cofre de senha do Sistema)
cmdkey /list
Exibe informações da licença / Status licenciamento
slmgr /dli
Data de validade do estado da licença atual / Status Ativação
slmgr /xpr
Listar todos DCs:
netdom /query dc
Listar PDC:
netdom /query pdc
Listar FSMOs:
netdom /query fsmo
fmember /list USER
Lista os DHCP autorizados no AD
netsh dhcp show server
Compara o conteúdo entre arquivos
fc file1 file2
Exibe informações importantes, como:
Data de instalação do SO, tempo de inicialização do Sistema, KBs instalados, placas de rede, domínio, servidor de logon (DC autenticado), etc…
systeminfo
Lista credenciais salvas (cofre de senha do Sistema)
cmdkey /list
Exibe informações da licença / Status licenciamento
slmgr /dli
Data de validade do estado da licença atual / Status Ativação
slmgr /xpr
Listar todos DCs:
netdom /query dc
Listar PDC:
netdom /query pdc
Listar FSMOs:
netdom /query fsmo
View apt history
Show recently installed packages
grep "install " /var/log/dpkg.log
Show recently upgraded packages
grep "upgrade " /var/log/dpkg.log
Show recently removed packages
grep "remove " /var/log/dpkg.log
To view info from old log files use zgrep instead grep
zgrep "upgrade " /var/log/dpkg.log.2.gz
Zabbix jqzabbix API login error
Edit file plugins/jqzabbix.js/jqzabbix.js, and change default params in function createAjaxOption()
to:
// default params if (method != 'user.login') {
params = $.extend({
extendoutput : true,
limit : options.limit
}, params);
}
to:
// default params if (method != 'user.login') {
params = $.extend({
extendoutput : true,
limit : options.limit
}, params);
}
Assinar:
Postagens (Atom)
Updatable objects appear as 'no longer supported'
Symptoms In some scenarios, the following validation warning appears on an updatable object: " Object is no longer supported. Enforci...
Mais vistos
-
Java Keytool Command These commands allow you to generate a new Java Keytool keystore file, create a CSR, and import certificates. A...
-
Kaspersky seems to be storing windows update files on the C Drive: Here -> C:\ProgramData\KasperskyLab\adminkit\1093\.working Change fo...
-
This particular error is generally experienced when people attempt a non NTFS volume such as ReFS to a DFSR replication group as documented...