| Title | Author | Age | Description |
|---|---|---|---|
| Read Gmail POP | Will Steele | Fri, 27 Jan 2012 07:17:55 | This script is a proof of concept. Further work needs to be done. It requires the user to enter a valid username and password for a gmail.com account. It then attempts to form an SSL connection with the server, and, retrieve the first email. Unfortunately it returns random results. Perhaps someone can improve upon it with some more sockets knowledge than I have. |
| AddTo-HostsFile | Will Steele | Sun, 24 Jul 2011 07:41:51 | Add entries to the Windows hosts file. The function checks first to see if the entry exists in the file. If the entry does not exist, the function adds the entry and verifies it was added. Please feel free to add improvements. The function Utility.Time-Stamp is another helper function I use to denote the current Time. It can be found here: http://poshcode.org/2795. |
| AddTo-HostsFile | Will Steele | Sun, 24 Jul 2011 07:38:55 | Add entries to the Windows hosts file. The function checks first to see if the entry exists in the file. If the entry does not exist, the function adds the entry and verifies it was added. Please feel free to add improvements. |
| Write-Log | Will Steele | Sat, 23 Jul 2011 06:10:25 | Logging function for Powershell v2. Needed to address current Powershell logging limitations. See a discussion about said limitations here: http://jdhitsolutions.com/blog/2011/03/powershell-automatic-logging/#comment-2899 . Logs to file and prints messages to the console and optionally logs to the system event logs. Note – admin rights are required when specifying the EventLogName parameter because the SourceExists method requires admin rights because it checks rights on the Security log. This limitation seems silly to me and if you think so as well get Microsoft to fix it by voting here: https://connect.microsoft.com/VisualStudio/feedback/details/293617/eventlog-sourceexists-always-fails-for-non-administrators#tabs . Feel free to add features as necessary. Will Steele: I suggest adding the Encoding switch to the Out-File calls (lines 58 and 60) to ensure the file didn’t clog up the output file. I also added a parameter, $LogEncoding, (lines 37-38) to allow for Encoding selection. The default is ASCII. It might be worth adding a few lines that allow for folder creation using the input file parameter. For instance, if the folder path referenced in the -Path parameter is invalid it doesn’t handle this. Example: dir | Write-Log -Path C:\test\test\test.txt |
| Time-Stamp | Will Steele | Sun, 17 Jul 2011 15:03:24 | This is a very simple function that returns a DateTime time stamp. I use it in scripts for noting times when actions occur like this Write-Host “$(Time-Stamp): Attempting to create directory.”; It’s a lot shorter than writing out the whole thing. You can also alias it to simplify the process: New-Alias -Name ts -Value Time-Stamp;. This way I use Write-Host “$(ts): Attempting to create directory.”; It outputs: 2011.07.17 05:01:10: Attempting to create directory. You can alter the value in the ToString to change the way the time stamp is formatted. |
PowerShell Code Repository