Important windows commands

    • Check the remote port status
      curl -v telnet://<IP>:<Port>
      Test-NetConnection <IP> -port <Port>
      
    • Check website access request ( PowerShell)
      Invoke-WebRequest -uri <URL>
      
    • Mapping port using SSH tunnel
      ssh -N  <user>@<remote_host>  -L 8080:localhost:80
      This command will open a listening port 8080  on localhost mapping remote port  80 of <remote_host>
    • Mapping remote server port using SSH tunnel intermediate server
      ssh -N  <user>@<intermediate_host>  -L 8636:<remote_host>:636
      This command will open a listening port 8636  on localhost mapping remote port 636 of <remote_host>
    • Sending email from powershell
      $User = "<your username>"
      $Password = "<your Password>"
      $SecurePassword = ConvertTo-SecureString $Password -AsPlainText -Force
      $Cred = New-Object System.Management.Automation.PSCredential($User, $SecurePassword)
      ## sending with encryption ( TLS)
      Send-MailMessage -From "test@enquesta.io" -To "mrahman@harriscomputer.com" -Subject "STARTTLS Test" -Body "Hello" -SmtpServer "smtp.sendgrid.net" -Port 587 -Credential $Cred -UseSsl
      ## sending without SSL
      Send-MailMessage -From "test@enquesta.io" -To "mrahman@harriscomputer.com" -Subject "STARTTLS Test" -Body "Hello" -SmtpServer "smtp.sendgrid.net" -Port 587 -Credential $Cred 
      ## sending with encryption (SSL)
      ## sending with ssl ( TLS)
      Send-MailMessage -From "test@enquesta.io" -To "mrahman@harriscomputer.com" -Subject "STARTTLS Test" -Body "Hello" -SmtpServer "smtp.sendgrid.net" -Port 465 -Credential $Cred -UseSsl
    • Check the last boot time
      systeminfo | find /i "Boot Time"
    • Get your public IP programmatically
      curl ipconfig.io
    • Change timezone from Windows cmd.
      tzutil /g # check current time zone
      tzutil /l # list all timezones
      tzutil /s "Central Standard Time" # set time zone
    •  Check the Resultant Set of Policy (RSoP) or Active Directory Group policy information for a target user and computer.
      gpresult /r
    •  Check AD user details.
      net user <username> /DOMAIN

Leave a Reply

Your email address will not be published. Required fields are marked *