Section 7.12. Shorthand for Frequently Used Data


7.12. Shorthand for Frequently Used Data

To 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)" }




Monad Jumpstart
Monad Jumpstart
ISBN: N/A
EAN: N/A
Year: 2005
Pages: 117

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net