Set AdUser Home Directory in PowerShell

 Using the Set-AdUser cmdlet in PowerShell to set the home directory folder path.

Set-ADUser -Identity Arons -HomeDirectory 'D:\Arons'
 
Get-Aduser -Identity Arons -Properties * | Select SamAccountName,HomeDirectory,HomeDrive,ProfilePath

Clean /var/log/journal

 

$ du -hs /var/log/journal/
4.1G    /var/log/journal/

4,1 GB de arquivos de diários, com o mais antigo datando de mais de dois meses.

$ ls -lath /var/log/journal/*/ | tail -n 2
-rw-r-x---+ 1 root systemd-journal 8.0M Dec 24 05:15 user-xxx.journal

Limpe systemd journals de mais de X dias

A primeira é baseada no tempo, limpando todo o suporte de há mais de, digamos, 10 dias.

$ journalctl --vacuum-time=10d

Vacuuming done, freed 2.3G of archived journals on disk.

Alternativamente, você pode limitar seu tamanho total.
Limpe systemd journals se eles excederem X de armazenamento

Este exemplo manterá 2GB de logs, limpando tudo o que excede isso.

$ journalctl --vacuum-size=2G

Vacuuming done, freed 720.0M of archived journals on disk.

 

 

Windows update error 0x8024500c

Stop windows update service

Type %windir%\SoftwareDistribution\DataStore in this new window and click OK.
 

This will open Windows Explorer on the correct location.
 

Delete all contents of this folder. (Hint: Use Ctrl + A to select all files and folders)

In the new windows you have a navigation on the left side. Use it to navigate to

HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate
 

Once you found it, search for WUServer and WIStatusServer in the right hand pane.


If they are not listet we cannot clean the download path. Othwerwise delete both.
Restart your computer.

 

 

 

Kaspersky Security Center WSUS Files Storage Location

 Kaspersky seems to be storing windows update files on the C Drive:

Here -> C:\ProgramData\KasperskyLab\adminkit\1093\.working

Change folder location with klsrvswch.exe utility. 

You can reach it from the KSC installation folder. Utility named as "Administration Server Account Switch Utility". It seems like just allows you to switch service account, but also allows to change "wsus" folder path. Continue wizard as if you want to switch service account. You don't need to provide a new service account, you can use current. Last step is the place of path change.

 

Limit SSH access by user and network

 Add user filtering with AllowUsers option in sshd_config file:

AllowUsers johndoe@192.168.1.* admin2@192.168.1.* otherid1 otherid2

This allows johndoe and admin2 only from 192.168.1.* addresses and otherid1, otherid2 from anywhere.

 

 

Send Mail with Office365 Auth

 Step-1

    mkdir ~/.certs

Step-2

    certutil -N -d ~/.certs
    Enter a password which will be used to encrypt your keys.
    The password should be at least 8 characters long,
    and should contain at least one non-alphabetic character.

    Enter new password:
    Re-enter password:


Step-3

    echo -n | openssl s_client -starttls smtp -crlf -connect smtp.office365.com:587| sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > ~/.certs/365.crt
    certutil -A -n "Google Internet Authority" -t "C,," -d ~/.certs -i ~/.certs/365.crt

Step-4

    vim  mail-office365.sh
    echo -e "Email content" | mailx -v -s "Email subject" \
     -S smtp-auth=login \
     -S smtp-use-starttls \
     -S nss-config-dir=~/.certs \
     -S smtp=smtp.office365.com:587 \
     -S from="user@office365.com" \
     -S smtp-auth-user=user@office365.com \
     -S smtp-auth-password="passwordxxxx" \
     -S ssl-verify=ignore \
    user@gmail.com

Rename windows computer command

Command Prompt:

netdom renamecomputer Thecomputernamehere /newname:newnamehere /force /userd:domain\username /passwordd:***** /reboot

 

Powershell:

Example 1: Rename the local computer

This command renames the local computer to Server044 and then restarts it to make the change effective.
PowerShell

Rename-Computer -NewName "Server044" -DomainCredential Domain01\Admin01 -Restart

Example 2: Rename a remote computer

This command renames the Srv01 computer to Server001. The computer is not restarted.

The DomainCredential parameter specifies the credentials of a user who has permission to rename computers in the domain.

The Force parameter suppresses the confirmation prompt.
PowerShell

Rename-Computer -ComputerName "Srv01" -NewName "Server001" -DomainCredential Domain01\Admin01 -Force

 

Adicionar registro DNS windows linha de comando

 Usando o Prompt de Comando (dnscmd)Abra o Prompt de Comando como Administrador e utilize a seguinte estrutura para adicionar um registro do...

Mais vistos