SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 478 | Next

Steve Seguis

"Microsoft Windows Server 2008 Administration"

For example,
wouldn??™t you like to know what the date and time will be three months from now? How
about 145 hours from now? This is a no-brainer with Windows PowerShell. To answer
those two questions, you simply need to run these:
(Get-Date).AddMonths(3)
(Get-Date).AddHours(145)
Get-Date has methods to add seconds, minutes, hours, days, months, and years called
AddSeconds, AddMinutes, AddHours, and so on. What happens if you want to find out
the date and time of an event before the current time? There is no SubtractSeconds or
457 Chapter 13: Windows PowerShell
MinusSeconds method in Get-Date. But the process is simple, really: Subtraction is
nothing more than addition of a negative number, so to find out the date and time 30 hours
ago or two years ago, you simply run one of the following:
(Get-Date).AddHours(-30)
(Get-Date).AddYears(-2)
You can set the system time using the Set-Date cmdlet. To specify a specific date
and time to set it to, you can use the -date switch and pass in the date and time as a
string, like so:
Set-Date -date "9/5/2007 9:00 AM"
If your computer clock is running 2 hours late, you could type in the new date and
time, or you could simply rely on your trusty Get-Date cmdlet to help you out:
Set-Date (Get-Date).AddHours(2)
Sometimes you need to calculate the difference between two times??”such as if you
are timing the execution of a script, maybe even your login script.


Pages:
466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490
hotel jelenia góra Russian bride Free English grammar and study guid powiekszenia wielkoformatowe counter strike 1.6