JustPaste
HomeCategoriesAboutDonateContactTerms of UsePrivacy Policy
JustPaste

Free online notepad — write and share instantly

Navigate

  • Home
  • Timeline
  • Categories

Info

  • About
  • Donate
  • Contact

Legal

  • Terms of Use
  • Privacy Policy

© 2026 JustPaste.app. All rights reserved.

Made with ♥ by JustPaste

Untitled Page | JustPaste.app
22 days ago7 views
👨‍💻Programming

Windows PowerShell

Copyright (C) Microsoft Corporation. All rights reserved.

Install the latest PowerShell for new features and improvements! https://aka.ms/PSWindows PS C:\Users\Mujtaba> # Fetching time from Google server via HTTPS (TCP 443) PS C:\Users\Mujtaba> $response = Invoke-WebRequest -Uri "https://www.google.com" -UseBasicParsing

PS C:\Users\Mujtaba> $dateString = $response.Headers["Date"]

PS C:\Users\Mujtaba>

PS C:\Users\Mujtaba> # Parsing the date string to local time

PS C:\Users\Mujtaba> $serverTime = [DateTime]::ParseExact($dateString, "r", [System.Globalization.CultureInfo]::InvariantCulture).ToLocalTime()

PS C:\Users\Mujtaba>

PS C:\Users\Mujtaba> # Setting the system time (Requires Admin rights)

PS C:\Users\Mujtaba> Set-Date -Date $serverTime

Set-Date : A required privilege is not held by the client

At line:1 char:1

+ Set-Date -Date $serverTime

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~

+ CategoryInfo : NotSpecified: (:) [Set-Date], Win32Exception

+ FullyQualifiedErrorId : System.ComponentModel.Win32Exception,Microsoft.PowerShell.Commands.SetDateCommand

PS C:\Users\Mujtaba> Write-Host "System time successfully synchronized to: $serverTime"

System time successfully synchronized to: 05/12/2026 21:14:22

PS C:\Users\Mujtaba>

← Back to timeline