7.12. Shorthand for Frequently Used DataTo generate a Windows-style domain and username combination: MSH D:\MshScripts> function whoami { "$env:USERDOMAIN\$env:USERNAME" } For quick access to the current time and other convenient instants: MSH D:\MshScripts> alias now get-date MSH D:\MshScripts> function yesterday { (get-date).AddDays(-1) } MSH D:\MshScripts> function tomorrow { (get-date).AddDays(1) } MSH D:\MshScripts> function lastweek { (get-date).AddWeeks(-1) } For a quick report of the operating system and version from WMI: MSH D:\MshScripts> function ver { $os = get-wmiobject Win32_OperatingSystem; "$($os.Caption)'n$($os.CSDVersion)" } |