Notes

Notes

Training mode

© 2025

Dark Mode

Commands I often use

There are some command I often use.

1) Printer:

Check printer port printui /s

Get list of printer from powershell Get-Printer | format-table Name, PortName

Rename printer in powershell Rename-Printer -name "Current name" -NewName "Your printer new name"

2) Powershell sending email

Send-MailMessage -From 'EMAIL for SENDING' -To 'RECEPIENT EMAIL' -Subject "Testing from powershell" -Body "Sending Test Email from Powershell." -DeliveryNotificationOption OnSuccess, OnFailure -Credential 'EMAIL for SENDING' -SmtpServer 'CLIENT SMTP server' -Port '587' -UseSSL

3) Reset folder permission

C:\Windows\System32>takeown /r /d y /f K:\TestFolder
C:\Windows\System32>icacls K:\TestFolder /t /grant Everyone:(OI)(CI)F

4) Kill connections to database

USE master;
GO
ALTER DATABASE [Your Database]
SET SINGLE_USER
WITH ROLLBACK IMMEDIATE;
ALTER DATABASE [Your database]
SET MULTI_USER;
GO

5) Test port open

Test-NetConnection -ComputerName abc.com -Port 80 -InformationLevel "Detailed"