├── README ├── .DS_Store ├── .gitignore ├── modules ├── Readme1st.txt ├── WPK │ ├── WPF.ps1xml │ ├── WPK.psd1 │ ├── WPK.psm1 │ ├── Add-GridRow.ps1 │ ├── Show-Window.ps1 │ ├── Close-Control.ps1 │ ├── Get-Resource.ps1 │ ├── Move-Control.ps1 │ ├── Set-Property.ps1 │ ├── Set-Resource.ps1 │ ├── Start-WPFJob.ps1 │ ├── Test-Ancestor.ps1 │ ├── Update-WPFJob.ps1 │ ├── Add-ChildControl.ps1 │ ├── Add-EventHandler.ps1 │ ├── Add-GridColumn.ps1 │ ├── ConvertTo-Xaml.ps1 │ ├── Examples │ │ ├── flyin.ps1 │ │ ├── Gradient.ps1 │ │ ├── ListView.ps1 │ │ ├── Stopwatch.ps1 │ │ ├── DataTemplate.ps1 │ │ ├── DigitalClock.ps1 │ │ ├── FlowDocument.ps1 │ │ ├── RunCommand.ps1 │ │ ├── Show-Module.ps1 │ │ ├── SimpleDialog.ps1 │ │ ├── CmdletExample.ps1 │ │ ├── ImportWinForms.ps1 │ │ ├── ListBoxSamples.ps1 │ │ ├── MutlitouchDraw.ps1 │ │ ├── SkewAnimation.ps1 │ │ ├── AddGridRowExample.ps1 │ │ ├── CanvasFromDesign.ps1 │ │ ├── EllipseAnimation.ps1 │ │ ├── MutlitouchImage.ps1 │ │ ├── canvasfromblend.ps1 │ │ ├── MoveControlExamples.ps1 │ │ ├── MixingArgumentFormats.ps1 │ │ ├── PowerShellDataSources.ps1 │ │ ├── RichTextBoxAndCommands.ps1 │ │ └── AnimatedLinesFromCenter.ps1 │ ├── Get-ChildControl.ps1 │ ├── Hide-UIElement.ps1 │ ├── Show-UIElement.ps1 │ ├── Start-Animation.ps1 │ ├── Test-Descendent.ps1 │ ├── Enable-Multitouch.ps1 │ ├── Export-Application.ps1 │ ├── Get-CommandPlugin.ps1 │ ├── ConvertTo-GridLength.ps1 │ ├── Get-HashtableAsObject.ps1 │ ├── Get-ReferencedCommand.ps1 │ ├── Get-UIElementPosition.ps1 │ ├── Remove-ChildControl.ps1 │ ├── Add-CodeGenerationRule.ps1 │ ├── ConvertTo-DataTemplate.ps1 │ ├── Copy-DependencyProperty.ps1 │ ├── Get-CommonParentControl.ps1 │ ├── Get-DependencyProperty.ps1 │ ├── Set-DependencyProperty.ps1 │ ├── Start-PowerShellCommand.ps1 │ ├── Stop-PowerShellCommand.ps1 │ ├── Get-PowerShellDataSource.ps1 │ ├── Register-PowerShellCommand.ps1 │ ├── ConvertTo-ParameterMetaData.ps1 │ ├── Join-PowerShellCommandOutput.ps1 │ ├── Rules │ │ └── WPFCodeGenerationRules.ps1 │ ├── Unregister-PowerShellCommand.ps1 │ └── ConvertFrom-TypeToScriptCmdlet.ps1 ├── PSRSS │ ├── PSRSS.psd1 │ ├── PSRSS.psm1 │ ├── Get-Feed.ps1 │ ├── New-Feed.ps1 │ ├── Get-Article.ps1 │ ├── Remove-Feed.ps1 │ ├── Read-Article.ps1 │ ├── Remove-Article.ps1 │ └── En-Us │ │ ├── about_PSRSS_Readme.help.txt │ │ └── about_PSRSS_Module.help.txt ├── DotNet │ ├── DotNet.psm1 │ ├── Get-Type.ps1 │ ├── Get-ProgID.ps1 │ └── Get-CommandWithParameterType.ps1 ├── IsePack │ ├── Colorize.ps1 │ ├── IsePack.psd1 │ ├── IsePack.psm1 │ ├── Add-IseMenu.ps1 │ ├── Invoke-Line.ps1 │ ├── Push-Module.ps1 │ ├── Show-Member.ps1 │ ├── Add-InlineHelp.ps1 │ ├── Add-Parameter.ps1 │ ├── Get-ShellVerb.ps1 │ ├── New-IseScript.ps1 │ ├── Split-IseFile.ps1 │ ├── Add-IfStatement.ps1 │ ├── Export-FormatView.ps1 │ ├── Get-CurrentToken.ps1 │ ├── Get-TokenFromFile.ps1 │ ├── Move-ToLastGroup.ps1 │ ├── Move-ToNextGroup.ps1 │ ├── Select-AllInFile.ps1 │ ├── Add-SwitchStatement.ps1 │ ├── Get-CurrentFunction.ps1 │ ├── Select-CurrentText.ps1 │ ├── Add-ForeachStatement.ps1 │ ├── Close-AllOpenedFiles.ps1 │ ├── Get-FunctionFromFile.ps1 │ ├── Show-TypeConstructor.ps1 │ ├── Switch-CommentOrText.ps1 │ ├── Move-ToLastPowerShellTab.ps1 │ ├── Move-ToNextPowerShellTab.ps1 │ ├── Push-CurrentFileLocation.ps1 │ ├── Save-IseFileWithAutoName.ps1 │ ├── Select-CurrentTextAsType.ps1 │ ├── ConvertTo-ShortcutKeyTable.ps1 │ ├── Get-CurrentOpenedFileToken.ps1 │ ├── Select-CurrentTextAsCommand.ps1 │ ├── Select-CurrentTextAsVariable.ps1 │ ├── Show-HelpForCurrentSelection.ps1 │ ├── Show-SyntaxForCurrentCommand.ps1 │ ├── Switch-SelectedCommentOrText.ps1 │ ├── En-US │ │ ├── about_IsePack_Readme.help.txt │ │ └── about_ISEPack_Module.help.txt │ ├── Show-TypeConstructorForCurrentType.ps1 │ ├── New-ScriptModuleFromCurrentLocation.ps1 │ └── Add-PInvoke.ps1 ├── FileSystem │ ├── Get-SHA1.ps1 │ ├── New-Zip.ps1 │ ├── Copy-ToZip.ps1 │ ├── FileSystem.psd1 │ ├── FileSystem.psm1 │ ├── Rename-Drive.ps1 │ ├── Get-DuplicateFile.ps1 │ ├── Get-FreeDiskSpace.ps1 │ ├── Mount-SpecialFolder.ps1 │ ├── Resolve-ShortcutFile.ps1 │ ├── Start-FileSystemWatcher.ps1 │ └── en-us │ │ ├── about_FileSystem_Module.help.txt │ │ └── about_FileSystem_Readme.help.txt ├── PSCodeGen │ ├── New-Enum.ps1 │ ├── PSCodeGen.psd1 │ ├── PSCodeGen.psm1 │ ├── New-PInvoke.ps1 │ └── New-ScriptCmdlet.ps1 ├── PSImageTools │ ├── Get-Image.ps1 │ ├── Background.png │ ├── Add-CropFilter.ps1 │ ├── ConvertTo-Jpeg.ps1 │ ├── PSImageTools.psd1 │ ├── PSImageTools.psm1 │ ├── Add-OverlayFilter.ps1 │ ├── Add-ScaleFilter.ps1 │ ├── ConvertTo-Bitmap.ps1 │ ├── Get-ImageProperty.ps1 │ ├── Set-ImageFilter.ps1 │ ├── Add-RotateFlipFilter.ps1 │ ├── Example │ │ ├── SortByCamera.ps1 │ │ └── FilterImagesInDirectory.ps1 │ ├── FilterImagesInDirectory.ps1 │ ├── Copy-ImageIntoOrganizedFolder.ps1 │ └── En-US │ │ ├── about_PSImageTools_Readme.help.txt │ │ └── about_PSImageTools_Module.help.txt ├── PSSystemTools │ ├── Get-Font.ps1 │ ├── Get-USB.ps1 │ ├── Test-32Bit.ps1 │ ├── Test-64Bit.ps1 │ ├── Get-OSVersion.ps1 │ ├── Get-Processor.ps1 │ ├── Get-BootStatus.ps1 │ ├── Get-SystemFont.ps1 │ ├── Import-IniFile.ps1 │ ├── PSSystemTools.psd1 │ ├── PSSystemTools.psm1 │ ├── Get-DisplaySetting.ps1 │ ├── Get-WindowsEdition.ps1 │ ├── Get-MultiTouchMaximum.ps1 │ ├── Get-LogicalDiskInventory.ps1 │ └── en-us │ │ ├── about_PSSystemTools_Readme.help.txt │ │ └── about_System_Module.help.txt ├── TaskScheduler │ ├── New-Task.ps1 │ ├── Remove-Task.ps1 │ ├── Start-Task.ps1 │ ├── Stop-Task.ps1 │ ├── Add-TaskAction.ps1 │ ├── Add-TaskTrigger.ps1 │ ├── Get-RunningTask.ps1 │ ├── TaskScheduler.psd1 │ ├── TaskScheduler.psm1 │ ├── Examples │ │ ├── example1.ps1 │ │ ├── example2.ps1 │ │ ├── example3.ps1 │ │ ├── example4.ps1 │ │ ├── example5.ps1 │ │ └── example6.ps1 │ ├── Get-ScheduledTask.ps1 │ ├── Connect-ToTaskScheduler.ps1 │ ├── Register-ScheduledTask.ps1 │ ├── TaskScheduler.Format.ps1xml │ └── TaskScheduler.Types.ps1xml ├── PSUserTools │ ├── Get-Everyone.ps1 │ ├── PSUserTools.psd1 │ ├── PSUserTools.psm1 │ ├── Get-CurrentUser.ps1 │ ├── Test-IsAdministrator.ps1 │ ├── Start-ProcessAsAdministrator.ps1 │ └── En-US │ │ ├── about_PSUserTools_Readme.help.txt │ │ └── about_PSUserTools_Module.help.txt ├── PowerShellPack │ ├── PowerShellPack.psm1 │ └── PowershellPack.psd1 ├── SushiHangover-Tools │ ├── Clear-Trash.ps1 │ ├── Initialize-File.ps1 │ ├── Process-VolumeDefrag.ps1 │ ├── SushiHangover-Tools.psd1 │ ├── foobar │ │ ├── runas.ps1 │ │ ├── Do-IPAddress.ps1 │ │ └── Get-RandomString.ps1 │ ├── SushiHangover-Tools.psm1 │ ├── Test-IsElevatedUser.ps1 │ ├── Remove-ComObjectsFromMemory.ps1 │ ├── Get-RemovableMedia.ps1 │ ├── SushiHangover-Tools.ps1 │ ├── Uninstall-Software.ps1 │ ├── Sleep-Computer.ps1 │ ├── Dismount-RemovableMedia.ps1 │ ├── Get-InstalledSoftware.ps1 │ ├── Clear-IECache.ps1 │ ├── Disable-WindowsSearch.ps1 │ ├── Get-WindowsLicenseStatus.ps1 │ ├── Do-FileEncoding.ps1 │ ├── Test-ModuleLoaded.ps1 │ ├── Process-RawPipe.ps1 │ ├── Process-Grep.ps1 │ ├── MyCredentials.ps1 │ ├── GZip.ps1 │ ├── ClearIECache.cs │ ├── Get-GeoIP.ps1 │ └── Install-WindowsUpdates.ps1 ├── Writing User Interfaces with WPK.docx ├── About the Windows 7 Resource Kit PowerShell Pack.docx ├── SushiHangover-RSACrypto │ ├── UnitTest-RSACrypto.ps1 │ └── SushiHangover-RSACrypto.psm1 ├── Setup │ ├── PowerShellPack.wixproj │ └── PowerShellPack.wxs └── SushiHangover-Transcripts │ └── SushiHangover-Transcripts.psm1 ├── Microsoft.PowerShell_profile.ps1 └── LICENSE /README: -------------------------------------------------------------------------------- 1 | PowerShell Scripts are from sushihangover.blogspot.com 2 | 3 | -------------------------------------------------------------------------------- /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/.DS_Store -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | Transcripts 2 | 3 | modules/.DS_Store 4 | 5 | modules/SushiHangover-Tools/.DS_Store 6 | -------------------------------------------------------------------------------- /modules/Readme1st.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/Readme1st.txt -------------------------------------------------------------------------------- /modules/WPK/WPF.ps1xml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/WPK/WPF.ps1xml -------------------------------------------------------------------------------- /modules/WPK/WPK.psd1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/WPK/WPK.psd1 -------------------------------------------------------------------------------- /modules/WPK/WPK.psm1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/WPK/WPK.psm1 -------------------------------------------------------------------------------- /modules/PSRSS/PSRSS.psd1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/PSRSS/PSRSS.psd1 -------------------------------------------------------------------------------- /modules/PSRSS/PSRSS.psm1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/PSRSS/PSRSS.psm1 -------------------------------------------------------------------------------- /modules/DotNet/DotNet.psm1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/DotNet/DotNet.psm1 -------------------------------------------------------------------------------- /modules/DotNet/Get-Type.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/DotNet/Get-Type.ps1 -------------------------------------------------------------------------------- /modules/PSRSS/Get-Feed.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/PSRSS/Get-Feed.ps1 -------------------------------------------------------------------------------- /modules/PSRSS/New-Feed.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/PSRSS/New-Feed.ps1 -------------------------------------------------------------------------------- /modules/WPK/Add-GridRow.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/WPK/Add-GridRow.ps1 -------------------------------------------------------------------------------- /modules/WPK/Show-Window.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/WPK/Show-Window.ps1 -------------------------------------------------------------------------------- /modules/DotNet/Get-ProgID.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/DotNet/Get-ProgID.ps1 -------------------------------------------------------------------------------- /modules/IsePack/Colorize.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/IsePack/Colorize.ps1 -------------------------------------------------------------------------------- /modules/IsePack/IsePack.psd1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/IsePack/IsePack.psd1 -------------------------------------------------------------------------------- /modules/IsePack/IsePack.psm1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/IsePack/IsePack.psm1 -------------------------------------------------------------------------------- /modules/PSRSS/Get-Article.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/PSRSS/Get-Article.ps1 -------------------------------------------------------------------------------- /modules/PSRSS/Remove-Feed.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/PSRSS/Remove-Feed.ps1 -------------------------------------------------------------------------------- /modules/WPK/Close-Control.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/WPK/Close-Control.ps1 -------------------------------------------------------------------------------- /modules/WPK/Get-Resource.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/WPK/Get-Resource.ps1 -------------------------------------------------------------------------------- /modules/WPK/Move-Control.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/WPK/Move-Control.ps1 -------------------------------------------------------------------------------- /modules/WPK/Set-Property.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/WPK/Set-Property.ps1 -------------------------------------------------------------------------------- /modules/WPK/Set-Resource.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/WPK/Set-Resource.ps1 -------------------------------------------------------------------------------- /modules/WPK/Start-WPFJob.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/WPK/Start-WPFJob.ps1 -------------------------------------------------------------------------------- /modules/WPK/Test-Ancestor.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/WPK/Test-Ancestor.ps1 -------------------------------------------------------------------------------- /modules/WPK/Update-WPFJob.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/WPK/Update-WPFJob.ps1 -------------------------------------------------------------------------------- /Microsoft.PowerShell_profile.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/Microsoft.PowerShell_profile.ps1 -------------------------------------------------------------------------------- /modules/FileSystem/Get-SHA1.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/FileSystem/Get-SHA1.ps1 -------------------------------------------------------------------------------- /modules/FileSystem/New-Zip.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/FileSystem/New-Zip.ps1 -------------------------------------------------------------------------------- /modules/IsePack/Add-IseMenu.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/IsePack/Add-IseMenu.ps1 -------------------------------------------------------------------------------- /modules/IsePack/Invoke-Line.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/IsePack/Invoke-Line.ps1 -------------------------------------------------------------------------------- /modules/IsePack/Push-Module.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/IsePack/Push-Module.ps1 -------------------------------------------------------------------------------- /modules/IsePack/Show-Member.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/IsePack/Show-Member.ps1 -------------------------------------------------------------------------------- /modules/PSCodeGen/New-Enum.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/PSCodeGen/New-Enum.ps1 -------------------------------------------------------------------------------- /modules/PSCodeGen/PSCodeGen.psd1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/PSCodeGen/PSCodeGen.psd1 -------------------------------------------------------------------------------- /modules/PSCodeGen/PSCodeGen.psm1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/PSCodeGen/PSCodeGen.psm1 -------------------------------------------------------------------------------- /modules/PSRSS/Read-Article.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/PSRSS/Read-Article.ps1 -------------------------------------------------------------------------------- /modules/PSRSS/Remove-Article.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/PSRSS/Remove-Article.ps1 -------------------------------------------------------------------------------- /modules/WPK/Add-ChildControl.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/WPK/Add-ChildControl.ps1 -------------------------------------------------------------------------------- /modules/WPK/Add-EventHandler.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/WPK/Add-EventHandler.ps1 -------------------------------------------------------------------------------- /modules/WPK/Add-GridColumn.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/WPK/Add-GridColumn.ps1 -------------------------------------------------------------------------------- /modules/WPK/ConvertTo-Xaml.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/WPK/ConvertTo-Xaml.ps1 -------------------------------------------------------------------------------- /modules/WPK/Examples/flyin.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/WPK/Examples/flyin.ps1 -------------------------------------------------------------------------------- /modules/WPK/Get-ChildControl.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/WPK/Get-ChildControl.ps1 -------------------------------------------------------------------------------- /modules/WPK/Hide-UIElement.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/WPK/Hide-UIElement.ps1 -------------------------------------------------------------------------------- /modules/WPK/Show-UIElement.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/WPK/Show-UIElement.ps1 -------------------------------------------------------------------------------- /modules/WPK/Start-Animation.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/WPK/Start-Animation.ps1 -------------------------------------------------------------------------------- /modules/WPK/Test-Descendent.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/WPK/Test-Descendent.ps1 -------------------------------------------------------------------------------- /modules/FileSystem/Copy-ToZip.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/FileSystem/Copy-ToZip.ps1 -------------------------------------------------------------------------------- /modules/FileSystem/FileSystem.psd1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/FileSystem/FileSystem.psd1 -------------------------------------------------------------------------------- /modules/FileSystem/FileSystem.psm1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/FileSystem/FileSystem.psm1 -------------------------------------------------------------------------------- /modules/IsePack/Add-InlineHelp.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/IsePack/Add-InlineHelp.ps1 -------------------------------------------------------------------------------- /modules/IsePack/Add-Parameter.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/IsePack/Add-Parameter.ps1 -------------------------------------------------------------------------------- /modules/IsePack/Get-ShellVerb.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/IsePack/Get-ShellVerb.ps1 -------------------------------------------------------------------------------- /modules/IsePack/New-IseScript.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/IsePack/New-IseScript.ps1 -------------------------------------------------------------------------------- /modules/IsePack/Split-IseFile.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/IsePack/Split-IseFile.ps1 -------------------------------------------------------------------------------- /modules/PSCodeGen/New-PInvoke.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/PSCodeGen/New-PInvoke.ps1 -------------------------------------------------------------------------------- /modules/PSImageTools/Get-Image.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/PSImageTools/Get-Image.ps1 -------------------------------------------------------------------------------- /modules/PSSystemTools/Get-Font.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/PSSystemTools/Get-Font.ps1 -------------------------------------------------------------------------------- /modules/PSSystemTools/Get-USB.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/PSSystemTools/Get-USB.ps1 -------------------------------------------------------------------------------- /modules/TaskScheduler/New-Task.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/TaskScheduler/New-Task.ps1 -------------------------------------------------------------------------------- /modules/WPK/Enable-Multitouch.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/WPK/Enable-Multitouch.ps1 -------------------------------------------------------------------------------- /modules/WPK/Examples/Gradient.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/WPK/Examples/Gradient.ps1 -------------------------------------------------------------------------------- /modules/WPK/Examples/ListView.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/WPK/Examples/ListView.ps1 -------------------------------------------------------------------------------- /modules/WPK/Examples/Stopwatch.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/WPK/Examples/Stopwatch.ps1 -------------------------------------------------------------------------------- /modules/WPK/Export-Application.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/WPK/Export-Application.ps1 -------------------------------------------------------------------------------- /modules/WPK/Get-CommandPlugin.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/WPK/Get-CommandPlugin.ps1 -------------------------------------------------------------------------------- /modules/FileSystem/Rename-Drive.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/FileSystem/Rename-Drive.ps1 -------------------------------------------------------------------------------- /modules/IsePack/Add-IfStatement.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/IsePack/Add-IfStatement.ps1 -------------------------------------------------------------------------------- /modules/IsePack/Export-FormatView.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/IsePack/Export-FormatView.ps1 -------------------------------------------------------------------------------- /modules/IsePack/Get-CurrentToken.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/IsePack/Get-CurrentToken.ps1 -------------------------------------------------------------------------------- /modules/IsePack/Get-TokenFromFile.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/IsePack/Get-TokenFromFile.ps1 -------------------------------------------------------------------------------- /modules/IsePack/Move-ToLastGroup.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/IsePack/Move-ToLastGroup.ps1 -------------------------------------------------------------------------------- /modules/IsePack/Move-ToNextGroup.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/IsePack/Move-ToNextGroup.ps1 -------------------------------------------------------------------------------- /modules/IsePack/Select-AllInFile.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/IsePack/Select-AllInFile.ps1 -------------------------------------------------------------------------------- /modules/PSImageTools/Background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/PSImageTools/Background.png -------------------------------------------------------------------------------- /modules/PSSystemTools/Test-32Bit.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/PSSystemTools/Test-32Bit.ps1 -------------------------------------------------------------------------------- /modules/PSSystemTools/Test-64Bit.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/PSSystemTools/Test-64Bit.ps1 -------------------------------------------------------------------------------- /modules/PSUserTools/Get-Everyone.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/PSUserTools/Get-Everyone.ps1 -------------------------------------------------------------------------------- /modules/PSUserTools/PSUserTools.psd1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/PSUserTools/PSUserTools.psd1 -------------------------------------------------------------------------------- /modules/PSUserTools/PSUserTools.psm1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/PSUserTools/PSUserTools.psm1 -------------------------------------------------------------------------------- /modules/TaskScheduler/Remove-Task.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/TaskScheduler/Remove-Task.ps1 -------------------------------------------------------------------------------- /modules/TaskScheduler/Start-Task.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/TaskScheduler/Start-Task.ps1 -------------------------------------------------------------------------------- /modules/TaskScheduler/Stop-Task.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/TaskScheduler/Stop-Task.ps1 -------------------------------------------------------------------------------- /modules/WPK/ConvertTo-GridLength.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/WPK/ConvertTo-GridLength.ps1 -------------------------------------------------------------------------------- /modules/WPK/Examples/DataTemplate.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/WPK/Examples/DataTemplate.ps1 -------------------------------------------------------------------------------- /modules/WPK/Examples/DigitalClock.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/WPK/Examples/DigitalClock.ps1 -------------------------------------------------------------------------------- /modules/WPK/Examples/FlowDocument.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/WPK/Examples/FlowDocument.ps1 -------------------------------------------------------------------------------- /modules/WPK/Examples/RunCommand.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/WPK/Examples/RunCommand.ps1 -------------------------------------------------------------------------------- /modules/WPK/Examples/Show-Module.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/WPK/Examples/Show-Module.ps1 -------------------------------------------------------------------------------- /modules/WPK/Examples/SimpleDialog.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/WPK/Examples/SimpleDialog.ps1 -------------------------------------------------------------------------------- /modules/WPK/Get-HashtableAsObject.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/WPK/Get-HashtableAsObject.ps1 -------------------------------------------------------------------------------- /modules/WPK/Get-ReferencedCommand.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/WPK/Get-ReferencedCommand.ps1 -------------------------------------------------------------------------------- /modules/WPK/Get-UIElementPosition.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/WPK/Get-UIElementPosition.ps1 -------------------------------------------------------------------------------- /modules/WPK/Remove-ChildControl.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/WPK/Remove-ChildControl.ps1 -------------------------------------------------------------------------------- /modules/IsePack/Add-SwitchStatement.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/IsePack/Add-SwitchStatement.ps1 -------------------------------------------------------------------------------- /modules/IsePack/Get-CurrentFunction.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/IsePack/Get-CurrentFunction.ps1 -------------------------------------------------------------------------------- /modules/IsePack/Select-CurrentText.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/IsePack/Select-CurrentText.ps1 -------------------------------------------------------------------------------- /modules/PSCodeGen/New-ScriptCmdlet.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/PSCodeGen/New-ScriptCmdlet.ps1 -------------------------------------------------------------------------------- /modules/PSImageTools/Add-CropFilter.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/PSImageTools/Add-CropFilter.ps1 -------------------------------------------------------------------------------- /modules/PSImageTools/ConvertTo-Jpeg.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/PSImageTools/ConvertTo-Jpeg.ps1 -------------------------------------------------------------------------------- /modules/PSImageTools/PSImageTools.psd1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/PSImageTools/PSImageTools.psd1 -------------------------------------------------------------------------------- /modules/PSImageTools/PSImageTools.psm1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/PSImageTools/PSImageTools.psm1 -------------------------------------------------------------------------------- /modules/PSSystemTools/Get-OSVersion.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/PSSystemTools/Get-OSVersion.ps1 -------------------------------------------------------------------------------- /modules/PSSystemTools/Get-Processor.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/PSSystemTools/Get-Processor.ps1 -------------------------------------------------------------------------------- /modules/PSUserTools/Get-CurrentUser.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/PSUserTools/Get-CurrentUser.ps1 -------------------------------------------------------------------------------- /modules/WPK/Add-CodeGenerationRule.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/WPK/Add-CodeGenerationRule.ps1 -------------------------------------------------------------------------------- /modules/WPK/ConvertTo-DataTemplate.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/WPK/ConvertTo-DataTemplate.ps1 -------------------------------------------------------------------------------- /modules/WPK/Copy-DependencyProperty.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/WPK/Copy-DependencyProperty.ps1 -------------------------------------------------------------------------------- /modules/WPK/Examples/CmdletExample.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/WPK/Examples/CmdletExample.ps1 -------------------------------------------------------------------------------- /modules/WPK/Examples/ImportWinForms.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/WPK/Examples/ImportWinForms.ps1 -------------------------------------------------------------------------------- /modules/WPK/Examples/ListBoxSamples.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/WPK/Examples/ListBoxSamples.ps1 -------------------------------------------------------------------------------- /modules/WPK/Examples/MutlitouchDraw.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/WPK/Examples/MutlitouchDraw.ps1 -------------------------------------------------------------------------------- /modules/WPK/Examples/SkewAnimation.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/WPK/Examples/SkewAnimation.ps1 -------------------------------------------------------------------------------- /modules/WPK/Get-CommonParentControl.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/WPK/Get-CommonParentControl.ps1 -------------------------------------------------------------------------------- /modules/WPK/Get-DependencyProperty.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/WPK/Get-DependencyProperty.ps1 -------------------------------------------------------------------------------- /modules/WPK/Set-DependencyProperty.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/WPK/Set-DependencyProperty.ps1 -------------------------------------------------------------------------------- /modules/WPK/Start-PowerShellCommand.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/WPK/Start-PowerShellCommand.ps1 -------------------------------------------------------------------------------- /modules/WPK/Stop-PowerShellCommand.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/WPK/Stop-PowerShellCommand.ps1 -------------------------------------------------------------------------------- /modules/FileSystem/Get-DuplicateFile.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/FileSystem/Get-DuplicateFile.ps1 -------------------------------------------------------------------------------- /modules/FileSystem/Get-FreeDiskSpace.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/FileSystem/Get-FreeDiskSpace.ps1 -------------------------------------------------------------------------------- /modules/FileSystem/Mount-SpecialFolder.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/FileSystem/Mount-SpecialFolder.ps1 -------------------------------------------------------------------------------- /modules/IsePack/Add-ForeachStatement.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/IsePack/Add-ForeachStatement.ps1 -------------------------------------------------------------------------------- /modules/IsePack/Close-AllOpenedFiles.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/IsePack/Close-AllOpenedFiles.ps1 -------------------------------------------------------------------------------- /modules/IsePack/Get-FunctionFromFile.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/IsePack/Get-FunctionFromFile.ps1 -------------------------------------------------------------------------------- /modules/IsePack/Show-TypeConstructor.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/IsePack/Show-TypeConstructor.ps1 -------------------------------------------------------------------------------- /modules/IsePack/Switch-CommentOrText.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/IsePack/Switch-CommentOrText.ps1 -------------------------------------------------------------------------------- /modules/PSImageTools/Add-OverlayFilter.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/PSImageTools/Add-OverlayFilter.ps1 -------------------------------------------------------------------------------- /modules/PSImageTools/Add-ScaleFilter.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/PSImageTools/Add-ScaleFilter.ps1 -------------------------------------------------------------------------------- /modules/PSImageTools/ConvertTo-Bitmap.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/PSImageTools/ConvertTo-Bitmap.ps1 -------------------------------------------------------------------------------- /modules/PSImageTools/Get-ImageProperty.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/PSImageTools/Get-ImageProperty.ps1 -------------------------------------------------------------------------------- /modules/PSImageTools/Set-ImageFilter.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/PSImageTools/Set-ImageFilter.ps1 -------------------------------------------------------------------------------- /modules/PSSystemTools/Get-BootStatus.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/PSSystemTools/Get-BootStatus.ps1 -------------------------------------------------------------------------------- /modules/PSSystemTools/Get-SystemFont.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/PSSystemTools/Get-SystemFont.ps1 -------------------------------------------------------------------------------- /modules/PSSystemTools/Import-IniFile.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/PSSystemTools/Import-IniFile.ps1 -------------------------------------------------------------------------------- /modules/PSSystemTools/PSSystemTools.psd1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/PSSystemTools/PSSystemTools.psd1 -------------------------------------------------------------------------------- /modules/PSSystemTools/PSSystemTools.psm1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/PSSystemTools/PSSystemTools.psm1 -------------------------------------------------------------------------------- /modules/PowerShellPack/PowerShellPack.psm1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/PowerShellPack/PowerShellPack.psm1 -------------------------------------------------------------------------------- /modules/PowerShellPack/PowershellPack.psd1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/PowerShellPack/PowershellPack.psd1 -------------------------------------------------------------------------------- /modules/TaskScheduler/Add-TaskAction.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/TaskScheduler/Add-TaskAction.ps1 -------------------------------------------------------------------------------- /modules/TaskScheduler/Add-TaskTrigger.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/TaskScheduler/Add-TaskTrigger.ps1 -------------------------------------------------------------------------------- /modules/TaskScheduler/Get-RunningTask.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/TaskScheduler/Get-RunningTask.ps1 -------------------------------------------------------------------------------- /modules/TaskScheduler/TaskScheduler.psd1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/TaskScheduler/TaskScheduler.psd1 -------------------------------------------------------------------------------- /modules/TaskScheduler/TaskScheduler.psm1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/TaskScheduler/TaskScheduler.psm1 -------------------------------------------------------------------------------- /modules/WPK/Examples/AddGridRowExample.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/WPK/Examples/AddGridRowExample.ps1 -------------------------------------------------------------------------------- /modules/WPK/Examples/CanvasFromDesign.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/WPK/Examples/CanvasFromDesign.ps1 -------------------------------------------------------------------------------- /modules/WPK/Examples/EllipseAnimation.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/WPK/Examples/EllipseAnimation.ps1 -------------------------------------------------------------------------------- /modules/WPK/Examples/MutlitouchImage.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/WPK/Examples/MutlitouchImage.ps1 -------------------------------------------------------------------------------- /modules/WPK/Examples/canvasfromblend.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/WPK/Examples/canvasfromblend.ps1 -------------------------------------------------------------------------------- /modules/WPK/Get-PowerShellDataSource.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/WPK/Get-PowerShellDataSource.ps1 -------------------------------------------------------------------------------- /modules/WPK/Register-PowerShellCommand.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/WPK/Register-PowerShellCommand.ps1 -------------------------------------------------------------------------------- /modules/FileSystem/Resolve-ShortcutFile.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/FileSystem/Resolve-ShortcutFile.ps1 -------------------------------------------------------------------------------- /modules/IsePack/Move-ToLastPowerShellTab.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/IsePack/Move-ToLastPowerShellTab.ps1 -------------------------------------------------------------------------------- /modules/IsePack/Move-ToNextPowerShellTab.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/IsePack/Move-ToNextPowerShellTab.ps1 -------------------------------------------------------------------------------- /modules/IsePack/Push-CurrentFileLocation.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/IsePack/Push-CurrentFileLocation.ps1 -------------------------------------------------------------------------------- /modules/IsePack/Save-IseFileWithAutoName.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/IsePack/Save-IseFileWithAutoName.ps1 -------------------------------------------------------------------------------- /modules/IsePack/Select-CurrentTextAsType.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/IsePack/Select-CurrentTextAsType.ps1 -------------------------------------------------------------------------------- /modules/PSSystemTools/Get-DisplaySetting.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/PSSystemTools/Get-DisplaySetting.ps1 -------------------------------------------------------------------------------- /modules/PSSystemTools/Get-WindowsEdition.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/PSSystemTools/Get-WindowsEdition.ps1 -------------------------------------------------------------------------------- /modules/PSUserTools/Test-IsAdministrator.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/PSUserTools/Test-IsAdministrator.ps1 -------------------------------------------------------------------------------- /modules/SushiHangover-Tools/Clear-Trash.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/SushiHangover-Tools/Clear-Trash.ps1 -------------------------------------------------------------------------------- /modules/TaskScheduler/Examples/example1.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/TaskScheduler/Examples/example1.ps1 -------------------------------------------------------------------------------- /modules/TaskScheduler/Examples/example2.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/TaskScheduler/Examples/example2.ps1 -------------------------------------------------------------------------------- /modules/TaskScheduler/Examples/example3.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/TaskScheduler/Examples/example3.ps1 -------------------------------------------------------------------------------- /modules/TaskScheduler/Examples/example4.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/TaskScheduler/Examples/example4.ps1 -------------------------------------------------------------------------------- /modules/TaskScheduler/Examples/example5.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/TaskScheduler/Examples/example5.ps1 -------------------------------------------------------------------------------- /modules/TaskScheduler/Examples/example6.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/TaskScheduler/Examples/example6.ps1 -------------------------------------------------------------------------------- /modules/TaskScheduler/Get-ScheduledTask.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/TaskScheduler/Get-ScheduledTask.ps1 -------------------------------------------------------------------------------- /modules/WPK/ConvertTo-ParameterMetaData.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/WPK/ConvertTo-ParameterMetaData.ps1 -------------------------------------------------------------------------------- /modules/WPK/Examples/MoveControlExamples.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/WPK/Examples/MoveControlExamples.ps1 -------------------------------------------------------------------------------- /modules/WPK/Join-PowerShellCommandOutput.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/WPK/Join-PowerShellCommandOutput.ps1 -------------------------------------------------------------------------------- /modules/WPK/Rules/WPFCodeGenerationRules.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/WPK/Rules/WPFCodeGenerationRules.ps1 -------------------------------------------------------------------------------- /modules/WPK/Unregister-PowerShellCommand.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/WPK/Unregister-PowerShellCommand.ps1 -------------------------------------------------------------------------------- /modules/DotNet/Get-CommandWithParameterType.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/DotNet/Get-CommandWithParameterType.ps1 -------------------------------------------------------------------------------- /modules/FileSystem/Start-FileSystemWatcher.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/FileSystem/Start-FileSystemWatcher.ps1 -------------------------------------------------------------------------------- /modules/IsePack/ConvertTo-ShortcutKeyTable.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/IsePack/ConvertTo-ShortcutKeyTable.ps1 -------------------------------------------------------------------------------- /modules/IsePack/Get-CurrentOpenedFileToken.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/IsePack/Get-CurrentOpenedFileToken.ps1 -------------------------------------------------------------------------------- /modules/IsePack/Select-CurrentTextAsCommand.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/IsePack/Select-CurrentTextAsCommand.ps1 -------------------------------------------------------------------------------- /modules/PSImageTools/Add-RotateFlipFilter.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/PSImageTools/Add-RotateFlipFilter.ps1 -------------------------------------------------------------------------------- /modules/PSImageTools/Example/SortByCamera.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/PSImageTools/Example/SortByCamera.ps1 -------------------------------------------------------------------------------- /modules/PSRSS/En-Us/about_PSRSS_Readme.help.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/PSRSS/En-Us/about_PSRSS_Readme.help.txt -------------------------------------------------------------------------------- /modules/PSSystemTools/Get-MultiTouchMaximum.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/PSSystemTools/Get-MultiTouchMaximum.ps1 -------------------------------------------------------------------------------- /modules/SushiHangover-Tools/Initialize-File.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/SushiHangover-Tools/Initialize-File.ps1 -------------------------------------------------------------------------------- /modules/WPK/ConvertFrom-TypeToScriptCmdlet.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/WPK/ConvertFrom-TypeToScriptCmdlet.ps1 -------------------------------------------------------------------------------- /modules/WPK/Examples/MixingArgumentFormats.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/WPK/Examples/MixingArgumentFormats.ps1 -------------------------------------------------------------------------------- /modules/WPK/Examples/PowerShellDataSources.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/WPK/Examples/PowerShellDataSources.ps1 -------------------------------------------------------------------------------- /modules/WPK/Examples/RichTextBoxAndCommands.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/WPK/Examples/RichTextBoxAndCommands.ps1 -------------------------------------------------------------------------------- /modules/Writing User Interfaces with WPK.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/Writing User Interfaces with WPK.docx -------------------------------------------------------------------------------- /modules/IsePack/Select-CurrentTextAsVariable.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/IsePack/Select-CurrentTextAsVariable.ps1 -------------------------------------------------------------------------------- /modules/IsePack/Show-HelpForCurrentSelection.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/IsePack/Show-HelpForCurrentSelection.ps1 -------------------------------------------------------------------------------- /modules/IsePack/Show-SyntaxForCurrentCommand.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/IsePack/Show-SyntaxForCurrentCommand.ps1 -------------------------------------------------------------------------------- /modules/IsePack/Switch-SelectedCommentOrText.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/IsePack/Switch-SelectedCommentOrText.ps1 -------------------------------------------------------------------------------- /modules/PSImageTools/FilterImagesInDirectory.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/PSImageTools/FilterImagesInDirectory.ps1 -------------------------------------------------------------------------------- /modules/TaskScheduler/Connect-ToTaskScheduler.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/TaskScheduler/Connect-ToTaskScheduler.ps1 -------------------------------------------------------------------------------- /modules/TaskScheduler/Register-ScheduledTask.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/TaskScheduler/Register-ScheduledTask.ps1 -------------------------------------------------------------------------------- /modules/TaskScheduler/TaskScheduler.Format.ps1xml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/TaskScheduler/TaskScheduler.Format.ps1xml -------------------------------------------------------------------------------- /modules/TaskScheduler/TaskScheduler.Types.ps1xml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/TaskScheduler/TaskScheduler.Types.ps1xml -------------------------------------------------------------------------------- /modules/WPK/Examples/AnimatedLinesFromCenter.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/WPK/Examples/AnimatedLinesFromCenter.ps1 -------------------------------------------------------------------------------- /modules/IsePack/En-US/about_IsePack_Readme.help.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/IsePack/En-US/about_IsePack_Readme.help.txt -------------------------------------------------------------------------------- /modules/PSSystemTools/Get-LogicalDiskInventory.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/PSSystemTools/Get-LogicalDiskInventory.ps1 -------------------------------------------------------------------------------- /modules/PSUserTools/Start-ProcessAsAdministrator.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/PSUserTools/Start-ProcessAsAdministrator.ps1 -------------------------------------------------------------------------------- /modules/SushiHangover-Tools/Process-VolumeDefrag.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/SushiHangover-Tools/Process-VolumeDefrag.ps1 -------------------------------------------------------------------------------- /modules/SushiHangover-Tools/SushiHangover-Tools.psd1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/SushiHangover-Tools/SushiHangover-Tools.psd1 -------------------------------------------------------------------------------- /modules/IsePack/Show-TypeConstructorForCurrentType.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/IsePack/Show-TypeConstructorForCurrentType.ps1 -------------------------------------------------------------------------------- /modules/PSImageTools/Copy-ImageIntoOrganizedFolder.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/PSImageTools/Copy-ImageIntoOrganizedFolder.ps1 -------------------------------------------------------------------------------- /modules/IsePack/New-ScriptModuleFromCurrentLocation.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/IsePack/New-ScriptModuleFromCurrentLocation.ps1 -------------------------------------------------------------------------------- /modules/PSImageTools/Example/FilterImagesInDirectory.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/PSImageTools/Example/FilterImagesInDirectory.ps1 -------------------------------------------------------------------------------- /modules/PSUserTools/En-US/about_PSUserTools_Readme.help.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/PSUserTools/En-US/about_PSUserTools_Readme.help.txt -------------------------------------------------------------------------------- /modules/About the Windows 7 Resource Kit PowerShell Pack.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/About the Windows 7 Resource Kit PowerShell Pack.docx -------------------------------------------------------------------------------- /modules/PSImageTools/En-US/about_PSImageTools_Readme.help.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/PSImageTools/En-US/about_PSImageTools_Readme.help.txt -------------------------------------------------------------------------------- /modules/PSSystemTools/en-us/about_PSSystemTools_Readme.help.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sushihangover/SushiHangover-PowerShell/HEAD/modules/PSSystemTools/en-us/about_PSSystemTools_Readme.help.txt -------------------------------------------------------------------------------- /modules/SushiHangover-Tools/foobar/runas.ps1: -------------------------------------------------------------------------------- 1 | If (-NOT ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) 2 | 3 | { 4 | $arguments = "& '" + $myinvocation.mycommand.definition + "'" 5 | Start-Process powershell -Verb runAs -ArgumentList $arguments 6 | Break 7 | } -------------------------------------------------------------------------------- /modules/SushiHangover-Tools/SushiHangover-Tools.psm1: -------------------------------------------------------------------------------- 1 | <# 2 | .NOTES 3 | Copyright 2013 Robert Nees 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | http://sushihangover.blogspot.com 6 | .SYNOPSIS 7 | Script module for SushiHangover-Tools 8 | .DESCRIPTION 9 | Script module for SushiHangover-Tools 10 | .LINK 11 | http://sushihangover.blogspot.com 12 | .LINK 13 | https://github.com/sushihangover 14 | #> -------------------------------------------------------------------------------- /modules/SushiHangover-Tools/Test-IsElevatedUser.ps1: -------------------------------------------------------------------------------- 1 | function Test-IsElevatedUser { 2 | <# 3 | .NOTES 4 | Copyright 2013 Robert Nees 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | http://sushihangover.blogspot.com 7 | .SYNOPSIS 8 | Elevated Privileges 9 | .DESCRIPTION 10 | Checks if the current Powershell instance is running with elevated privileges or not. 11 | .OUTPUTS 12 | System.Boolean : True if the current Powershell user is elevated, false if not. 13 | .EXAMPLE 14 | C:\PS>Test-IsElevatedUser 15 | False 16 | .LINK 17 | http://sushihangover.blogspot.com 18 | https://github.com/sushihangover 19 | #> 20 | param () 21 | $IsElevatedUser = $false 22 | try { 23 | $WindowsIdentity = [Security.Principal.WindowsIdentity]::GetCurrent() 24 | $WindowsPrincipal = New-Object Security.Principal.WindowsPrincipal -ArgumentList $WindowsIdentity 25 | $IsElevatedUser = $WindowsPrincipal.IsInRole( [Security.Principal.WindowsBuiltInRole]::Administrator ) 26 | } catch { 27 | throw "Elevated privileges is undetermined; the error was: '{0}'." -f $_ 28 | } 29 | return $IsElevatedUser 30 | } -------------------------------------------------------------------------------- /modules/SushiHangover-Tools/Remove-ComObjectsFromMemory.ps1: -------------------------------------------------------------------------------- 1 | Set-StrictMode –Version latest 2 | function Remove-ComObjectsFromMemory { 3 | <# 4 | .NOTES 5 | Copyright 2012 Robert Nees 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | http://sushihangover.blogspot.com 8 | .SYNOPSIS 9 | Releases all <__ComObject> objects in the caller scope. 10 | .DESCRIPTION 11 | Releases all <__ComObject> objects in the caller scope, except for those that are Read-Only or Constant. 12 | .EXAMPLE 13 | Remove-ComObject -Verbose 14 | Description 15 | =========== 16 | Releases <__ComObject> objects in the caller scope and displays the released COM objects' variable names. 17 | .LINK 18 | http://sushihangover.blogspot.com 19 | #> 20 | [CmdletBinding()] 21 | param() 22 | begin { 23 | } 24 | end { 25 | [Management.Automation.ScopedItemOptions]$scopedOpt = 'ReadOnly, Constant' 26 | Get-Variable -Scope 1 | Where-Object { 27 | $_.Value.pstypenames -contains 'System.__ComObject' -and -not ($scopedOpt -band $_.Options) 28 | } | Remove-Variable -Scope 1 -Verbose 29 | [GC]::Collect() 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /modules/PSUserTools/En-US/about_PSUserTools_Module.help.txt: -------------------------------------------------------------------------------- 1 | TOPIC 2 | about_PSUserTools_Module 3 | 4 | SHORT DESCRIPTION 5 | Describes the PSUserTools module in the Windows 7 Resource Kit. 6 | 7 | LONG DESCRIPTION 8 | The PSUserTools module contains functions that manage and edit users and user 9 | groups on the computer. 10 | 11 | The PSUserTools module adds the following functions to your session when you import 12 | the module. 13 | 14 | 15 | Get-CurrentUser Gets information about the current user. 16 | Get-Everyone Gets information about all local accounts on the computer. 17 | Start-ProcessAsAdministrator Starts a process with Administrator permssions 18 | ("Run as administrator"). 19 | 20 | Test-IsAdministrator Returns TRUE when the current user is an administrator. 21 | 22 | For information about these functions, use the Get-Help cmdlet. For example, 23 | to get detailed help for the Get-Feed function, type "get-help get-everyone -detailed." 24 | 25 | These functions are implemented in the module as scripts, but are available in the session 26 | as functions. 27 | 28 | 29 | SEE ALSO 30 | about_Modules 31 | Get-Module 32 | Import-Module 33 | Remove-Module -------------------------------------------------------------------------------- /modules/SushiHangover-Tools/Get-RemovableMedia.ps1: -------------------------------------------------------------------------------- 1 | Set-StrictMode –Version latest 2 | Function Get-RemovableMedia { 3 | <# 4 | .NOTES 5 | Copyright 2012/2013 Robert Nees 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | http://sushihangover.blogspot.com 8 | .SYNOPSIS 9 | List Removable Media 10 | .DESCRIPTION 11 | This scripts provides a way to list ('pipe-able' output) the removable media drives/information. 12 | 13 | Output are "Win32_LogicalDisk' objects 14 | .EXAMPLE 15 | Get-RemovableMedia 16 | 17 | DeviceID : E: 18 | DriveType : 2 19 | ProviderName : 20 | FreeSpace : 996462592 21 | Size : 1012469760 22 | VolumeName : 23 | .EXAMPLE 24 | Get-RemovableMedia | ForEach-Object{$_.DeviceID} 25 | 26 | A: 27 | E: 28 | .LINK 29 | http://sushihangover.blogspot.com 30 | .LINK 31 | https://github.com/sushihangover 32 | #> 33 | Param ( 34 | ) 35 | Begin { 36 | $RemovableMediaDrives = Get-WMIObject Win32_LogicalDisk -filter "DriveType=2" 37 | } 38 | Process { 39 | ForEach ($RemovableMedia in $RemovableMediaDrives) { 40 | $RemovableMedia 41 | } 42 | } 43 | End { 44 | $RemovableMedia = $null 45 | } 46 | } -------------------------------------------------------------------------------- /modules/SushiHangover-Tools/SushiHangover-Tools.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .NOTES 3 | Copyright 2012/2013 Robert Nees 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | http://sushihangover.blogspot.com 6 | .SYNOPSIS 7 | Script module called by SushiHangover-Tools.psd1 8 | .DESCRIPTION 9 | Script module called by SushiHangover-Tools.psd1 10 | .LINK 11 | http://sushihangover.blogspot.com 12 | .LINK 13 | https://github.com/sushihangover 14 | #> 15 | . $psScriptRoot\Initialize-File.ps1 16 | . $psScriptRoot\Clear-Trash.ps1 17 | . $psScriptRoot\Do-FileEncoding.ps1 18 | . $psScriptRoot\Get-WindowsLicenseStatus.ps1 19 | . $psScriptRoot\Remove-ComObjectsFromMemory.ps1 20 | . $psScriptRoot\Uninstall-Software.ps1 21 | . $psScriptRoot\Get-InstalledSoftware.ps1 22 | . $psScriptRoot\Dismount-RemovableMedia.ps1 23 | . $psScriptRoot\Get-RemovableMedia.ps1 24 | . $psScriptRoot\MyCredentials.ps1 25 | . $psScriptRoot\Test-IsElevatedUser.ps1 26 | . $psScriptRoot\Install-WindowsUpdates.ps1 27 | . $psScriptRoot\Clear-Trash.ps1 28 | . $psScriptRoot\Process-VolumeDefrag.ps1 29 | . $psScriptRoot\Disable-WindowsSearch.ps1 30 | . $psScriptRoot\Sleep-Computer.ps1 31 | . $psScriptRoot\Clear-IECache.ps1 32 | . $psScriptRoot\Process-Grep.ps1 33 | . $psScriptRoot\GZip.ps1 34 | . $psScriptRoot\Net-Tools.ps1 35 | . $psScriptRoot\Get-GeoIP.ps1 36 | . $psScriptRoot\Test-ModuleLoaded.ps1 37 | -------------------------------------------------------------------------------- /modules/SushiHangover-Tools/Uninstall-Software.ps1: -------------------------------------------------------------------------------- 1 | Set-StrictMode –Version latest 2 | Function Uninstall-Software { 3 | <# 4 | .NOTES 5 | Copyright 2012 Robert Nees 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | http://sushihangover.blogspot.com 8 | .SYNOPSIS 9 | Uninstall software 10 | .DESCRIPTION 11 | A way to script the uninstall of multiple software packages, a great 12 | way to batch remove 'obsolete' software... 13 | .EXAMPLE 14 | C:\PS>Uninstall-Software "VMWare Tools" -Whatif 15 | .EXAMPLE 16 | C:\PS>Uninstall-Software "VMWare Tools" -Confirm 17 | .EXAMPLE 18 | C:\PS>Uninstall-Software "%" -WhatIf 19 | Get a list of all installed software... 20 | .LINK 21 | http://sushihangover.blogspot.com 22 | https://github.com/sushihangover 23 | #> 24 | [cmdletbinding(SupportsShouldProcess=$True,ConfirmImpact="High")] 25 | param ( 26 | [parameter(Mandatory=$true,Position=0)][string]$Software 27 | ) 28 | Begin { 29 | $likeThis = "%" + $Software + "%" 30 | $Apps = Get-WmiObject -query "SELECT * FROM Win32_Product WHERE Name LIKE '$likeThis'" 31 | } 32 | Process { 33 | Foreach($App in $Apps) { 34 | if ($pscmdlet.ShouldProcess($App.name)) { 35 | $App.Uninstall() 36 | } 37 | $App 38 | } 39 | } 40 | End { 41 | $Apps = $null 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /modules/PSRSS/En-Us/about_PSRSS_Module.help.txt: -------------------------------------------------------------------------------- 1 | TOPIC 2 | about_PSRSS_Module 3 | 4 | SHORT DESCRIPTION 5 | Describes the PSRSS module in the Windows 7 Resource Kit. 6 | 7 | LONG DESCRIPTION 8 | The PSSS module contains functions that manage and edit RSS feeds and the 9 | the articles in the feeds. 10 | 11 | The PSRSS module adds the following functions to your session when you import 12 | the module. 13 | 14 | New-Feed Subscribes to an RSS feed and downloads the articles. 15 | Remove-Feed Unsubscribes to an RSS feed and deletes the articles. 16 | Get-Feed Gets the RSS feeds on your system. 17 | 18 | Get-Article Gets articles in the RSS feeds on your system. 19 | Read-Article Marks articles as read. 20 | Remove-Article Deletes articles from your system. 21 | 22 | 23 | For information about these functions, use the Get-Help cmdlet. For example, 24 | to get detailed help for the Get-Feed function, type "get-help get-feed -detailed." 25 | 26 | The functions in the PSRSS module uses COM based on the the Microsoft.FeedsManager 27 | class in the Windows RSS platform. These functions are implemented as scripts, but 28 | are available in the session as functions. 29 | 30 | 31 | SEE ALSO 32 | about_Modules 33 | Get-Module 34 | Import-Module 35 | Remove-Module 36 | 37 | "Windows RSS Platform": http://msdn.microsoft.com/en-us/library/ms684701(VS.85).aspx 38 | "Microsoft.FeedsManager Object: http://msdn.microsoft.com/en-us/library/ms684749(VS.85).aspx 39 | -------------------------------------------------------------------------------- /modules/IsePack/Add-PInvoke.ps1: -------------------------------------------------------------------------------- 1 | function Add-PInvoke 2 | { 3 | <# 4 | .Synopsis 5 | Creates C# code to access a C function 6 | .Description 7 | Creates C# code to access a C function 8 | .Example 9 | Add-PInvoke -Library User32.dll -Signature GetSystemMetrics(uint Metric) 10 | .Parameter Library 11 | A C Library containing code to invoke 12 | .Parameter Signature 13 | The C# signature of the external method 14 | .Parameter OutputText 15 | If Set, retuns the source code for the pinvoke method. 16 | If not, compiles the type. 17 | #> 18 | param( 19 | [Parameter(Mandatory=$true, 20 | HelpMessage="The C Library Containing the Function, i.e. User32")] 21 | [String] 22 | $Library, 23 | 24 | [Parameter(Mandatory=$true, 25 | HelpMessage="The Signature of the Method, i.e. int GetSystemMetrics(int Metric")] 26 | [String] 27 | $Signature, 28 | 29 | [Switch] 30 | $OutputText 31 | ) 32 | 33 | process { 34 | if ($Library -notlike "*.dll*") { 35 | $Library+=".dll" 36 | } 37 | if ($signature -notlike "*;") { 38 | $Signature+=";" 39 | } 40 | if ($signature -notlike "public static extern*") { 41 | $signature = "public static extern $signature" 42 | } 43 | 44 | $MemberDefinition = "[DllImport(`"$Library`")] 45 | $Signature" 46 | 47 | if (-not $OutputText) { 48 | Add-Type -PassThru -Name "PInvoke$(Get-Random)" ` 49 | -MemberDefinition $MemberDefinition 50 | } else { 51 | $MemberDefinition 52 | } 53 | } 54 | } -------------------------------------------------------------------------------- /modules/FileSystem/en-us/about_FileSystem_Module.help.txt: -------------------------------------------------------------------------------- 1 | TOPIC 2 | about_FileSystem_Module 3 | 4 | SHORT DESCRIPTION 5 | Describes the FileSystem module in the Windows 7 Resource Kit. 6 | 7 | LONG DESCRIPTION 8 | The FileSystem module contains functions that work on the file system 9 | drives in Windows PowerShell. 10 | 11 | The following functions are added to your session when you import 12 | the FileSystem module 13 | 14 | Copy-ToZip Compresses files and adds them to a ZIP file. 15 | Get-DuplicateFile Finds files that have identical file contents. 16 | Get-FreeDiskSpace Gets the free disk space on logical drives 17 | of the local computer or a remote computer. 18 | 19 | Get-SHA1 Computes the SHA1 hash of the specified file. 20 | Mount-SpecialFolder Creates PSDrives for special folders in the system. 21 | New-Zip Creates a new zip archive. 22 | Rename-Drive Renames a file system drive. 23 | 24 | For information about these functions, use the Get-Help cmdlet. For example, 25 | to get detailed help for the Copy-ToZip function, type "get-help copy-tozip -detailed." 26 | 27 | 28 | NOTE: The Mount-SpecialFolder is run automatically in your session when 29 | you import the FileSystem module. As a result, the session includes 30 | a Windows PowerShell drive (PSDrive) for each special folder in the 31 | system. 32 | 33 | These functions are implemented as scripts, but are available in the 34 | session as functions. 35 | 36 | 37 | SEE ALSO 38 | about_Modules 39 | Get-Module 40 | Import-Module 41 | Remove-Module 42 | -------------------------------------------------------------------------------- /modules/SushiHangover-Tools/Sleep-Computer.ps1: -------------------------------------------------------------------------------- 1 | Set-StrictMode –Version latest 2 | Function Sleep-Computer { 3 | <# 4 | .NOTES 5 | Copyright 2013 Robert Nees 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | http://sushihangover.blogspot.com 8 | .SYNOPSIS 9 | Place your computer into Sleep mode 10 | .DESCRIPTION 11 | Since there is not a cmdlet that will 'sleep' your computer, the Sleep-Computer function was born. You can use 12 | the force option to override/clear your hibernate setting and then sleep if you need to... 13 | .EXAMPLE 14 | c:\PS>Sleep-Computer -WhatIf 15 | What if: Performing operation "Sleep-Computer" on Target "SushiHangover-MacBookPro". 16 | .EXAMPLE 17 | c:\PS>Sleep-Computer -Confirm -Force 18 | 19 | Confirm 20 | Are you sure you want to perform this action? 21 | Performing operation "Sleep-Computer" on Target "V-RONEES-W8MBP". 22 | [Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): 23 | .LINK 24 | http://sushihangover.blogspot.com 25 | .LINK 26 | https://github.com/sushihangover 27 | #> 28 | [cmdletbinding(SupportsShouldProcess=$True,ConfirmImpact="Low")] 29 | param ( 30 | [parameter(mandatory=$false)][switch]$Force 31 | ) 32 | if ($pscmdlet.ShouldProcess($env:COMPUTERNAME)) { 33 | if ($Force.IsPresent) { 34 | if ($pscmdlet.ShouldProcess("Turning off hibernation")) { 35 | & powercfg -hibernate off 36 | } 37 | } 38 | $rundll = Join-Path -Path ($env:windir) -ChildPath "System32\rundll32.exe" 39 | & ($rundll) powrprof.dll,SetSuspendState 0,1,0 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /modules/PSSystemTools/en-us/about_System_Module.help.txt: -------------------------------------------------------------------------------- 1 | TOPIC 2 | about_System_Module 3 | 4 | SHORT DESCRIPTION 5 | Describes the System module in the Windows 7 Resource Kit. 6 | 7 | LONG DESCRIPTION 8 | The System module contains functions that get information about the operating 9 | system on the local and remote computers. 10 | 11 | The System module adds the following functions to your session when you import 12 | the module. 13 | 14 | Get-BootStatus Gets information about how the system was started, e.g. Safe Mode 15 | Get-DisplaySetting Gets the width and height of the primary monitor. 16 | Get-LogicalDiskInventory Gets the logical disks on the local and remote computers. 17 | Get-MultiTouchMaximum Gets the number of fingers that can be used on a multitouch device. 18 | Get-OSVersion Gets the operating system Version of a local or remote computer. 19 | Get-Processor Gets processor information for local and remote computers. 20 | Get-WindowsEdition Gets the operating system edition. 21 | Test-32Bit Returns TRUE when the computer has a 32-bit processor architecture. 22 | Test-64Bit Returns TRUE when the computer has a 64-bit processor architecture. 23 | 24 | 25 | For information about these functions, use the Get-Help cmdlet. For example, 26 | to get detailed help for the Get-Feed function, type "get-help get-bootstatus -detailed." 27 | 28 | These functions are implemented in the module as scripts, but are available in the session 29 | as functions. 30 | 31 | 32 | SEE ALSO 33 | about_Modules 34 | Get-Module 35 | Import-Module 36 | Remove-Module -------------------------------------------------------------------------------- /modules/SushiHangover-Tools/Dismount-RemovableMedia.ps1: -------------------------------------------------------------------------------- 1 | Set-StrictMode –Version latest 2 | Function Dismount-RemovableMedia { 3 | <# 4 | .NOTES 5 | Copyright 2012/2013 Robert Nees 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | http://sushihangover.blogspot.com 8 | .SYNOPSIS 9 | Eject Removable Media 10 | .DESCRIPTION 11 | This scripts provides a way to script the eject a removable media drive 12 | .EXAMPLE 13 | C:\PS>Do-Eject.ps1 E: -Confirm 14 | Confirm 15 | Are you sure you want to perform this action? 16 | Performing operation "Dismount-RemovableMedia" on Target "a:". 17 | [Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): 18 | .EXAMPLE 19 | >Dismount-RemovableMedia a: -whatif 20 | What if: Performing operation "Dismount-RemovableMedia" on Target "a:". 21 | .EXAMPLE 22 | >Get-RemovableMedia |foreach {if ($_.DeviceID -eq 'e:') {$_ |dismount-removablemedia -whatif}} 23 | What if: Performing operation "Dismount-RemovableMedia" on Target "E:". 24 | .LINK 25 | http://sushihangover.blogspot.com 26 | https://github.com/sushihangover 27 | #> 28 | [cmdletbinding(SupportsShouldProcess=$True,ConfirmImpact="Low")] 29 | Param ( 30 | [parameter(mandatory=$true,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true)][Alias("Drive")][string]$DeviceID 31 | ) 32 | Begin { 33 | $ShellApplication = New-Object -comObject Shell.Application 34 | } 35 | Process { 36 | if ($pscmdlet.ShouldProcess($DeviceID)) { 37 | $ShellApplication.Namespace(17).ParseName("$DeviceID").InvokeVerb("Eject") 38 | } 39 | } 40 | End { 41 | $ShellApplication = $null 42 | Remove-ComObjectsFromMemory 43 | } 44 | } -------------------------------------------------------------------------------- /modules/SushiHangover-RSACrypto/UnitTest-RSACrypto.ps1: -------------------------------------------------------------------------------- 1 | Set-StrictMode –Version latest 2 | <# 3 | .NOTES 4 | Copyright 2013 Robert Nees 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | http://sushihangover.blogspot.com 7 | .SYNOPSIS 8 | Test the SushiHangover-RSACrypto module 9 | .DESCRIPTION 10 | This is a collection of functions to test the SushiHangover-RSACrypto module 11 | 12 | It is not much of a unit test, but more like an example. 13 | 14 | If the Compare-Object output is different than the module is 'broken', please report 15 | any problems via SushiHangover on GitHub and/or http://sushihangover.blogspot.com 16 | .EXAMPLE 17 | UnitTest-RSACrypto.ps1 18 | .LINK 19 | http://sushihangover.blogspot.com 20 | #> 21 | Import-Module SushiHangover-RSACrypto 22 | $PemFile = $HOME + '\.ssh\SSH2RSA2048_private_test_key.pem' 23 | . Set-RSACryptoServiceProvider $PemFile 24 | $preclearText = "Hello, Lets keep this a secret, OK?" 25 | Write-Host 'Clear Text of:' 26 | Write-Host '--------------' 27 | Write-Host $preclearText -ForegroundColor Green 28 | Write-Host 29 | $preclearBytes = Convert-StringToByte $preclearText 30 | $clearBase64 = ConvertTo-Base64String $preclearBytes 31 | $cypherBytes = Get-RSAEncryptedBytes $clearBase64 $false 32 | $cypherBase64 = ConvertTo-Base64String $cypherBytes 33 | Write-Host 'Encrypted Base64 String:' 34 | Write-Host '------------------------' 35 | Write-Host $cypherBase64 -ForegroundColor Red 36 | Write-Host 37 | Write-Host 'Compare-Object output using input bytes via Get-RSAClearBytes:' 38 | $postclearBytes = Get-RSAClearBytes $cypherBase64 $false 39 | Compare-Object $preclearBytes $postclearBytes -CaseSensitive -IncludeEqual |Format-Table -AutoSize 40 | Write-Host 'Compare-Object output using clear text input via Get-RSAClearText:' 41 | $postclearText = Get-RSAClearText $cypherBase64 $false 42 | Write-Host 43 | Compare-Object $preclearText $postclearText -CaseSensitive -IncludeEqual 44 | Remove-Module SushiHangover-RSACrypto 45 | -------------------------------------------------------------------------------- /modules/SushiHangover-Tools/Get-InstalledSoftware.ps1: -------------------------------------------------------------------------------- 1 | Set-StrictMode –Version latest 2 | Function Get-InstalledSoftware { 3 | <# 4 | .NOTES 5 | Copyright 2012/2013 Robert Nees 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | http://sushihangover.blogspot.com 8 | .SYNOPSIS 9 | Get the software installed 10 | .DESCRIPTION 11 | A way to script the collection of software that has been installed on 12 | an Windows OS. Great for quick auditing, support desks, compliance checking, etc... 13 | 14 | The output is 'pipe-able' and in the object structure: 15 | 16 | IdentifyingNumber : {44D55920-B223-4702-81D9-4C07108A3C27} 17 | Name : VMware Tools 18 | Vendor : VMware, Inc. 19 | Version : 9.2.2.18018 20 | Caption : VMware Tools 21 | .EXAMPLE 22 | [11] » Get-InstalledSoftware 23 | 24 | IdentifyingNumber : {44D55920-B223-4702-81D9-4C07108A3C27} 25 | Name : VMware Tools 26 | Vendor : VMware, Inc. 27 | Version : 9.2.2.18018 28 | Caption : VMware Tools 29 | 30 | IdentifyingNumber : {5FCE6D76-F5DC-37AB-B2B8-22AB8CEDB1D4} 31 | Name : Microsoft Visual C++ 2008 Redistributable - x64 9.0.30729.6161 32 | Vendor : Microsoft Corporation 33 | Version : 9.0.30729.6161 34 | Caption : Microsoft Visual C++ 2008 Redistributable - x64 9.0.30729.6161 35 | .LINK 36 | http://sushihangover.blogspot.com 37 | .LINK 38 | https://github.com/sushihangover 39 | #> 40 | [cmdletbinding(SupportsShouldProcess=$True)] 41 | param ( 42 | # [parameter(Mandatory=$true,Position=0)][string]$Software 43 | ) 44 | Begin { 45 | $Apps = Get-WmiObject -query "SELECT * FROM Win32_Product" 46 | } 47 | Process { 48 | Foreach($App in $apps) { 49 | $App 50 | } 51 | } 52 | End { 53 | $App = $null 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /modules/SushiHangover-Tools/Clear-IECache.ps1: -------------------------------------------------------------------------------- 1 | Set-StrictMode –Version latest 2 | Function Clear-IECache { 3 | <# 4 | .NOTES 5 | Copyright 2012/2013 Robert Nees 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | http://sushihangover.blogspot.com 8 | .SYNOPSIS 9 | Clear Internet Explorer's cache 10 | .DESCRIPTION 11 | This function wraps a custom C# based function that clears the IE cache, this has been tested on Internet Explorer 8, 9, & 10. 12 | Clearing the cache, depending upon how many items are in it, can take some time. There currently are no call back 13 | events, thus I am not displaying a PowerShell Progress bar, but if someone asks, I can add that to the C# code. 14 | 15 | Note: You can not unload the ClearIECache assembly once loaded, this is a .NET behavior. Assemblies loaded into an AppDomain cannot be unloaded, 16 | and only the AppDomain can be unloaded, and PowerShell uses a single appdomain. You can work around this if required by loading this function into a 17 | separate process, calling it and then drop that other process, but for something this small I do not see the current need. Comments welcome. 18 | .EXAMPLE 19 | c:\PS>Clear-IECache 20 | .LINK 21 | http://sushihangover.blogspot.com 22 | .LINK 23 | https://github.com/sushihangover 24 | #> 25 | Param ( 26 | ) 27 | $CSFile = Join-Path -Path $PSScriptRoot -ChildPath 'ClearIECache.cs’ 28 | $SourceCode = [System.IO.File]::ReadAllText($CSFile) 29 | $Assemblies = ('System') #,'System.Collections.Generic','System.Ling','System.Text','System.Runtime.InteropServices') 30 | 31 | try { 32 | Add-Type -TypeDefinition $SourceCode -ReferencedAssemblies $Assemblies -IgnoreWarnings -Language CSharp 33 | } catch { 34 | Write-Warning "An error occurred attempting to add the .NET Framework class to the PowerShell session." 35 | Write-Warning "The error was: $($Error[0].Exception.Message)" 36 | } 37 | 38 | $ieCache = New-Object SushiHangover.ClearIECache 39 | $ieCache.Clear() 40 | $ieCache = $null 41 | } 42 | 43 | -------------------------------------------------------------------------------- /modules/SushiHangover-Tools/Disable-WindowsSearch.ps1: -------------------------------------------------------------------------------- 1 | Set-StrictMode –Version latest 2 | Function Disable-WindowsSearch { 3 | <# 4 | .NOTES 5 | Copyright 2012/2013 Robert Nees 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | http://sushihangover.blogspot.com 8 | .SYNOPSIS 9 | Stop and Set the Windows Search Indexer to disabled 10 | .DESCRIPTION 11 | Call me lazy, I get tried of typing the cmds to stop and disable the 12 | WSearch Service on the Windows 8 machines I touch.... I use them as jumpboxes 13 | to AWS, Azure, VPN based datacenters and the pauses during the indexing of scripts, transcripts, 14 | drives me insane... 15 | .EXAMPLE 16 | C:\PS>Disable-WindowsSearch -Confirm 17 | 18 | Confirm 19 | Are you sure you want to perform this action? 20 | Performing operation "Disable-WindowsSearch" on Target "System.ServiceProcess.ServiceController". 21 | [Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): y 22 | 23 | Confirm 24 | Are you sure you want to perform this action? 25 | Performing operation "Stop-Service" on Target "Windows Search (WSearch)". 26 | [Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): y 27 | WARNING: Waiting for service 'Windows Search (WSearch)' to stop... 28 | WARNING: Waiting for service 'Windows Search (WSearch)' to stop... 29 | WARNING: Waiting for service 'Windows Search (WSearch)' to stop... 30 | 31 | Confirm 32 | Are you sure you want to perform this action? 33 | Performing operation "Set-Service" on Target "Windows Search (WSearch)". 34 | [Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): y 35 | .LINK 36 | http://sushihangover.blogspot.com 37 | .LINK 38 | https://github.com/sushihangover 39 | #> 40 | [cmdletbinding(SupportsShouldProcess=$True,ConfirmImpact="Low")] 41 | Param ( 42 | [parameter(Mandatory=$false)][switch]$Enable 43 | ) 44 | Begin { 45 | } 46 | Process { 47 | $Service = Get-Service -Name 'WSearch' 48 | if ($pscmdlet.ShouldProcess($Service)) { 49 | if (!($Enable.IsPresent)) { 50 | if ($Service.Status -eq 'Running') { 51 | $Service | Stop-Service -Force 52 | } 53 | $Service | Set-Service -StartupType Disable 54 | } else { 55 | $Service | Set-Service -StartupType Automatic 56 | $Service | Start-Service 57 | } 58 | } 59 | } 60 | End { 61 | } 62 | } -------------------------------------------------------------------------------- /modules/Setup/PowerShellPack.wixproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Debug 5 | en-us 6 | false 7 | PowerShellPack 8 | package 9 | true 10 | bin\$(Configuration)\ 11 | false 12 | false 13 | 14 | 15 | 1.0.0 16 | Microsoft Corporation 17 | 18 | 19 | Manufacturer=$(Manufacturer); 20 | ProductName=$(ProjectName); 21 | ProductVersion=$(ProductVersion); 22 | 23 | 24 | 25 | Debug 26 | true 27 | true 28 | false 29 | 30 | 31 | false 32 | true 33 | 34 | 35 | 36 | 40 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | C:\Program Files\Windows Installer XML v3\bin\WixUIExtension.dll 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /modules/PSImageTools/En-US/about_PSImageTools_Module.help.txt: -------------------------------------------------------------------------------- 1 | TOPIC 2 | about_PSImageTools_Module 3 | 4 | SHORT DESCRIPTION 5 | Describes the PSImageTools module in the Windows 7 Resource Kit. 6 | 7 | LONG DESCRIPTION 8 | The PSImageTools module contains functions that manage and edit image files, such 9 | as photographs, in Windows PowerShell. 10 | 11 | The PSImageTools module adds the following basic functions to your session 12 | when you import the module. 13 | 14 | 15 | Get-Image Gets image objects with many useful properties. Provides 16 | methods to load, save, crop, resize, rotate, and flip images. 17 | 18 | Get-ImageProperty Gets extended properties for the image, such as shutter speed 19 | and resolution. 20 | 21 | Copy-ImageIntoOrganizedFolder 22 | Creates a set of folders based on properties that you specify 23 | and copies image files into the folders based on their 24 | property values. 25 | 26 | ConvertTo-Bitmap Converts images to bitmap format (.bmp). 27 | ConvertTo-Jpeg Converts images to JPEG format (.jpg, .jpeg). 28 | 29 | 30 | The PSImageTools module also adds filtering functions to your session. You can use these 31 | more advanced functions to edit images when the basic functions do not provide a feature 32 | that you need. 33 | 34 | The Add-*Filter functions create a Windows Image Acquisition filter that represents a change to one or 35 | more images. The filters alone do not change images. To apply a filter to an image, use 36 | the Set-ImageFilter function. 37 | 38 | Add-CropFilter Creates a filter that crops images. 39 | Add-OverlayFilter Creates a filter that overlays one image on another. 40 | Add-RotateFlipFilter Creates a filter that rotate and flips images. 41 | Add-ScaleFilter Creates a filter that resizes images. 42 | 43 | Set-ImageFilter Edits an image by applying a filter. 44 | 45 | For information about these functions, use the Get-Help cmdlet. For example, 46 | to get detailed help for the Get-Image function, type "get-help get-image -detailed." 47 | 48 | These functions are implemented as scripts, but are available in the 49 | session as functions. 50 | 51 | 52 | SEE ALSO 53 | about_Modules 54 | Get-Module 55 | Import-Module 56 | Remove-Module 57 | 58 | "Image Manipulation in PowerShell" (Windows PowerShell Team Blog) 59 | http://blogs.msdn.com/powershell/archive/2009/03/31/image-manipulation-in-powershell.aspx 60 | 61 | "ImageProcess object" in MSDN 62 | http://msdn.microsoft.com/en-us/library/ms630507(VS.85).aspx 63 | 64 | "How to Use Filters" in MSDN 65 | http://msdn.microsoft.com/en-us/library/ms630819(VS.85).aspx -------------------------------------------------------------------------------- /modules/Setup/PowerShellPack.wxs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /modules/SushiHangover-Transcripts/SushiHangover-Transcripts.psm1: -------------------------------------------------------------------------------- 1 | Set-StrictMode –Version latest 2 | <# 3 | .NOTES 4 | Copyright 2012,2013 Robert Nees 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | http://sushihangover.blogspot.com 7 | .SYNOPSIS 8 | Transcript Helpers 9 | .DESCRIPTION 10 | Helper function to start, stop, pause, resume and parse transcripts (records all or part of a Windows PowerShell session in a text file) 11 | .EXAMPLE 12 | .LINK 13 | http://sushihangover.blogspot.com 14 | #> 15 | 16 | Function Resume-Transcript { 17 | Start-Transcript -Append -Force -Path ($SH:TranscriptName) 18 | } 19 | 20 | Function Suspend-Transcript { 21 | Stop-Transcript 22 | } 23 | 24 | Function Show-Transcript { 25 | Invoke-Expression ($Global:SH:TranscriptName) 26 | } 27 | 28 | Function Initialize-TranscriptLocation { 29 | Register-EngineEvent PowerShell.Exiting { Stop-Transcript } | Out-Null 30 | $Transcript = Join-Path -Path ([environment]::GetFolderPath("MyDocuments")) -ChildPath "WindowsPowerShell" 31 | $Transcript = Join-Path -Path ($Transcript) -ChildPath ("Transcripts") 32 | if (!(Test-Path -Path $Transcript)) { 33 | New-item -Path $Transcript -ItemType Directory 34 | } 35 | Set-Variable -Name SH:TranscriptDir -Value $Transcript -Option Constant -Scope Global # This will be at the global scope level 36 | $Transcript = Join-Path -Path ($Transcript) -ChildPath ("Transcript-" + (Get-Date -uFormat "%Y-%m-%d-%H%M-PID") + $pid.ToString() + ".log") 37 | Set-Variable -Name SH:TranscriptName -Value $Transcript -Option Constant -Scope Global # This will be at the global scope level 38 | } 39 | 40 | Function Initialize-Transcript { 41 | Register-EngineEvent PowerShell.Exiting { Stop-Transcript } | Out-Null 42 | Start-Transcript -NoClobber -Force -Path $Global:SH:TranscriptName | Out-Null 43 | } 44 | 45 | #Function Find-Transcript { 46 | # [cmdletBinding()] 47 | # Param ( 48 | # [Parameter(Mandatory=$False)][Alias("filter")][string]$filterString, 49 | # [Parameter(Mandatory=$False)][Alias("i")][switch]$ignore_case, 50 | # [Parameter(Mandatory=$False)][Alias("v")][switch]$invert_match, 51 | # [Parameter(Mandatory=$False)][Alias("test")][switch]$debugOutput, 52 | # [Parameter(Mandatory=$False)][Alias("H")][switch]$with_filename, 53 | # [Parameter(Mandatory=$False)][Alias("ver")][switch]$version, 54 | # [Parameter(Mandatory=$False,ValueFromPipeline=$True)][string]$Path = '' 55 | # ) 56 | # Begin { 57 | # Suspend-Transcript | Out-Null 58 | # $args 59 | # } 60 | # Process { 61 | # if ($Path.Length -gt 0) { 62 | # cat $Path | Do-Grep @psBoundParameters 63 | # } else { 64 | # cat $TranscriptName|Do-Grep @psBoundParameters 65 | # } 66 | # } 67 | # End { 68 | # Restart-Transcript | Out-Null 69 | # } 70 | #} 71 | #Set-Alias -Name grep-log -Value Find-Transcript 72 | -------------------------------------------------------------------------------- /modules/SushiHangover-Tools/foobar/Do-IPAddress.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .NOTES 3 | Copyright 2012 Robert Nees 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | http://sushihangover.blogspot.com 6 | 7 | .SYNOPSIS 8 | Set static ip entries or dhcp addressing on a network interface 9 | .DESCRIPTION 10 | This script sets a network interface to either have dhcp or static ip addressing 11 | 12 | .EXAMPLE 13 | 14 | .LINK 15 | http://sushihangover.blogspot.com 16 | #> 17 | param( 18 | [parameter( 19 | parametersetname="Static", 20 | mandatory=$true, 21 | position=1)] 22 | [parameter( 23 | parametersetname="Dhcp", 24 | mandatory=$true, 25 | position=1)] 26 | [string]$NICName, 27 | [parameter( 28 | parametersetname="Dhcp", 29 | mandatory=$false, 30 | position=2)] 31 | [string]$reset = $false, 32 | [parameter( 33 | parametersetname="Static", 34 | mandatory=$true, 35 | position=2)] 36 | [string]$ip = '', 37 | [parameter( 38 | parametersetname="Static", 39 | mandatory=$true, 40 | position=3)] 41 | [string]$gateway, 42 | [parameter( 43 | parametersetname="Static", 44 | mandatory=$false, 45 | position=4)] 46 | [string]$mask = "255.255.255.0", 47 | [parameter( 48 | parametersetname="Static", 49 | mandatory=$false, 50 | position=5)] 51 | [string]$dns1 = "8.8.8.8", 52 | [parameter( 53 | parametersetname="Static", 54 | mandatory=$false, 55 | position=6)] 56 | [string]$dns2 = "8.8.4.4", 57 | [parameter( 58 | parametersetname="Static", 59 | mandatory=$false, 60 | position=7)] 61 | [string]$registerDns = "FALSE" 62 | ) 63 | $dns = $dns1 64 | if($dns2) { 65 | $dns ="$dns1,$dns2" 66 | } 67 | $NIC = (gwmi Win32_NetworkAdapter | where {$_.netconnectionid -eq $NICName}) 68 | if ($NIC.InterfaceIndex -gt 0) { 69 | $NetInterface = Get-WmiObject Win32_NetworkAdapterConfiguration | where {$_.InterfaceIndex -eq $NIC.InterfaceIndex} 70 | if ($NetInterface) { 71 | switch ($PsCmdlet.ParameterSetName) { 72 | "Static" { 73 | [void]$NetInterface.EnableStatic($ip, $subnetmask) 74 | [void]$NetInterface.SetGateways($gateway) 75 | [void]$NetInterface.SetDNSServerSearchOrder($dns) 76 | [void]$NetInterface.SetDynamicDNSRegistration($registerDns) 77 | [void]$NIC.Disable() 78 | [void]$NIC.Enable() 79 | } 80 | "Dhcp" { 81 | $NetInterface.EnableDHCP() 82 | if ($reset) { 83 | $NIC.Disable() 84 | $NIC.Enable() 85 | write-host $NIC.netconnectionid "was reset" 86 | } 87 | } 88 | } 89 | } 90 | } else { 91 | write-host "Network Adapter not found : " $NICName 92 | } 93 | 94 | 95 | -------------------------------------------------------------------------------- /modules/SushiHangover-Tools/Get-WindowsLicenseStatus.ps1: -------------------------------------------------------------------------------- 1 | Set-StrictMode –Version latest 2 | function Get-WindowsLicenseStatus{ 3 | <# 4 | .NOTES 5 | Copyright 2013 Robert Nees 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | http://sushihangover.blogspot.com 8 | .SYNOPSIS 9 | Get-WindowsLicensingStatus -- Check the License Status of Windows... 10 | .DESCRIPTION 11 | The original script is from 'The Scripting Guys' and I changed it to allow 12 | local Windows 8 machines to be checked while still supporting VMs if this is run all 13 | a Hyper-V Host 14 | 15 | http://blogs.technet.com/b/heyscriptingguy/archive/2012/08/21/use-powershell-to-check-the-license-status-of-windows-8.aspx 16 | .EXAMPLE 17 | PS C:\> Get-WindowsLicenseStatus.ps1 18 | This example trys to the license status of all the VMs running on this host, if the VMMS service is not 19 | running you wil get the license status of the localhost 20 | .EXAMPLE 21 | PS C:\> Get-WindowsLicenseStatus.ps1 -LocalHost 22 | This example returns the license status of the localhost 23 | .LINK 24 | http://sushihangover.blogspot.com 25 | #> 26 | Param ( 27 | [Parameter(Mandatory=$false)][alias('l')][Switch]$LocalHostOnly 28 | ) 29 | Try { 30 | if ($LocalHostOnly.IsPresent) { 31 | $cim = New-CimSession 32 | } else { 33 | $vm = get-vm -ErrorAction SilentlyContinue 34 | if ($vm -ne $null) { 35 | $cim = New-CimSession -ComputerName $vm.name # -ErrorAction SilentlyContinue 36 | } else { 37 | Throw "VMMSProblem" # The Virtual Machine Management Service is not running 38 | } 39 | } 40 | } Catch { 41 | if ($_.Exception.ToString() = "VMMSProblem") { 42 | $cim = New-CimSession # just grab the localhost instead 43 | Write-Output "Virtual Machine Host problem, showing LocalHost only:" 44 | } else { 45 | throw "Could not create a new CIM Session" 46 | exit 47 | } 48 | } 49 | if ($cim -ne $null) { 50 | get-ciminstance -class SoftwareLicensingProduct -CimSession $cim | 51 | where {$_.name -match 'windows' -AND $_.licensefamily} | 52 | format-list -property Name, Description, ` 53 | @{Label ="Grace period (days)"; Expression = { $_.graceperiodremaining / 1440}}, ` 54 | @{Label = "License Status"; Expression = { 55 | switch (foreach {$_.LicenseStatus}) { 56 | 0 {"Unlicensed"} ` 57 | 1 {"Licensed"} ` 58 | 2 {"Out-Of-Box Grace Period"} ` 59 | 3 {"Out-Of-Tolerance Grace Period"} ` 60 | 4 {"Non-Genuine Grace Period"} ` 61 | } 62 | } } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /modules/SushiHangover-Tools/Do-FileEncoding.ps1: -------------------------------------------------------------------------------- 1 | Set-StrictMode –Version latest 2 | function Get-FileEncoding { 3 | <# 4 | .NOTES 5 | Copyright 2012,2013 Robert Nees 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | http://sushihangover.blogspot.com 8 | ! Grap the original that this is based upon from http://poshcode.org/2059 9 | .SYNOPSIS 10 | Gets file encoding. 11 | .DESCRIPTION 12 | The Get-FileEncoding function determines encoding by looking at Byte Order Mark (BOM). 13 | Based on port of C# code from http://www.west-wind.com/Weblog/posts/197245.aspx 14 | .EXAMPLE 15 | Get-ChildItem *.ps1 | select FullName, @{n='Encoding';e={Get-FileEncoding $_.FullName}} | where {$_.Encoding -ne 'ASCII'} 16 | This command gets ps1 files in current directory where encoding is not ASCII 17 | .EXAMPLE 18 | Get-ChildItem *.ps1 | select FullName, @{n='Encoding';e={Get-FileEncoding $_.FullName}} | where {$_.Encoding -ne 'ASCII'} | foreach {(get-content $_.FullName) | set-content $_.FullName -Encoding ASCII} 19 | Same as previous example but fixes encoding using set-content 20 | .LINK 21 | http://sushihangover.blogspot.com 22 | .LINK 23 | 24 | #> 25 | [CmdletBinding()] 26 | Param ( 27 | [Parameter(Mandatory=$True, ValueFromPipeline=$True)][string]$Path 28 | ) 29 | Begin { 30 | } 31 | Process { 32 | [byte[]]$byte = get-content -Encoding byte -ReadCount 4 -TotalCount 4 -Path $Path 33 | if ($byte -ne $null) { 34 | if ($byte.Count -ge 4) { 35 | if ( $byte[0] -eq 0xef -and $byte[1] -eq 0xbb -and $byte[2] -eq 0xbf ) { 36 | Write-Output 'UTF8' 37 | } elseif ($byte[0] -eq 0xfe -and $byte[1] -eq 0xff) { 38 | Write-Output 'Unicode' 39 | } elseif ($byte[0] -eq 0 -and $byte[1] -eq 0 -and $byte[2] -eq 0xfe -and $byte[3] -eq 0xff) { 40 | Write-Output 'UTF32' 41 | } elseif ($byte[0] -eq 0x2b -and $byte[1] -eq 0x2f -and $byte[2] -eq 0x76) { 42 | Write-Output 'UTF7' 43 | } else { 44 | Write-Output 'ASCII' 45 | } 46 | } else { 47 | Write-Error -Message ($Path + " is only " + $byte.Count + " bytes in size, unable to determine file encoding") -Category InvalidData 48 | } 49 | } else { 50 | Write-Error -Message ($Path + " is zero byte(s) in size") -Category InvalidData 51 | } 52 | } 53 | End { 54 | } 55 | } 56 | 57 | Function Set-FileEncoding { 58 | <# 59 | .NOTES 60 | Copyright 2012,2013 Robert Nees 61 | Licensed under the Apache License, Version 2.0 (the "License"); 62 | http://sushihangover.blogspot.com 63 | .SYNOPSIS 64 | Sets/Changes file encoding. 65 | .DESCRIPTION 66 | The Set-FileEncoding function changes the file's encoding in place by using Set-Content 67 | with the default encoding being 'Ascii' 68 | EncodingTypes available are Unicode, Byte, BigEndianUnicode, UTF8, UTF7, Ascii 69 | .EXAMPLE 70 | Set-FileEncoding clear-trash.ps1 -whatif 71 | What if: Performing operation "Set Content" on Target "Path: C:\Users\xavier\Documents\WindowsPowerShell\clear-trash.ps1". 72 | #> 73 | [CmdletBinding()] 74 | Param ( 75 | [Parameter(Mandatory=$True,ValueFromPipelineByPropertyName=$True)][string]$Path, 76 | [Parameter(Mandatory=$False,ValueFromPipelineByPropertyName=$True)][string]$EncodingType = "Ascii", 77 | [Parameter(Mandatory=$False)][switch]$WhatIf 78 | ) 79 | if ((Get-FileEncoding $Path) -ne $EncodingType) { 80 | # Need to 'buffer' content as piping get and set will fail with file in use error... 81 | $FileContent = Get-Content $Path 82 | If ($WhatIf) { 83 | $FileContent | Set-Content $Path -WhatIf -Force -Encoding $EncodingType 84 | } else { 85 | $FileContent | Set-Content $Path -Force -Encoding $EncodingType 86 | } 87 | } else { 88 | If ($WhatIf) { 89 | "File encoding is the same, no file change will occur" 90 | } 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /modules/SushiHangover-Tools/Test-ModuleLoaded.ps1: -------------------------------------------------------------------------------- 1 | Function Test-AssemblyLoaded { 2 | <# 3 | .NOTES 4 | Copyright 2013 Robert Nees 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | .SYNOPSIS 7 | Test if an Assembly is loaded, pipeline'd AssemblyName input and pipeline'd boolean output 8 | .DESCRIPTION 9 | A helper to test and optionally load, an Assembly with input and output pipeline processing, supporting 10 | -WhatIf on the Assembly test and Verbose output if needed. 11 | .EXAMPLE 12 | Test-AssemblyLoaded -AssemblyName SushiHangover.GeoIP.LookupService -Verbose 13 | VERBOSE: Performing operation "Test-AssemblyLoaded" on Target "SushiHangover.GeoIP.LookupService". 14 | VERBOSE: SushiHangover.GeoIP.LookupService is available 15 | True 16 | .EXAMPLE 17 | C:\PS>"SushiHangover-BuildANewGirlFriend" | Test-AssemblyLoaded -Verbose 18 | VERBOSE: Performing operation "Test-AssemblyLoaded" on Target "SushiHangover-BuildANewGirlFriend". 19 | VERBOSE: SushiHangover-BuildANewGirlFriend is not available 20 | False 21 | #> 22 | [cmdletbinding(SupportsShouldProcess=$True,ConfirmImpact="Low")] 23 | Param ( 24 | [Parameter(Mandatory=$true,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true)][String]$AssemblyName 25 | ) 26 | Begin {} 27 | Process { 28 | [boolean]$Loaded = $false 29 | Try { 30 | if ($pscmdlet.ShouldProcess($AssemblyName)) { 31 | [reflection.assembly]::GetAssembly([type]$AssemblyName) | Out-Null 32 | Write-Verbose ($AssemblyName + " is available") 33 | $Loaded = $true 34 | } 35 | } Catch { 36 | # Do nothing but supressed error as $Loaded is set to $false by default 37 | Write-Verbose ($AssemblyName + " is not available") 38 | } 39 | $Loaded 40 | } 41 | End {} 42 | } 43 | Function Test-ModuleImported { 44 | <# 45 | .NOTES 46 | Copyright 2013 Robert Nees 47 | Licensed under the Apache License, Version 2.0 (the "License"); 48 | .SYNOPSIS 49 | Test if a Module is loaded, pipeline'd ModuleName input and pipeline'd boolean output 50 | .DESCRIPTION 51 | A helper to test and optionally load, a Module with input and output pipeline processing, supporting 52 | -WhatIf on the Module load and Verbose output if needed. 53 | .EXAMPLE 54 | c:\PS>[boolean]$Loaded = "SushiHangover-Tools" | Test-ModuleImported -Verbose 55 | VERBOSE: SushiHangover-Tools is not loaded 56 | .EXAMPLE 57 | c:\PS>"SushiHangover-Tools" | Test-ModuleImported -AutoLoad -WhatIf 58 | What if: Performing operation "Test-ModuleImported" on Target "SushiHangover-Tools". 59 | False 60 | .EXAMPLE 61 | C:\PS>"SushiHangover-Tools" | Test-ModuleImported -Verbose 62 | VERBOSE: SushiHangover-Tools is loaded 63 | True 64 | #> 65 | [cmdletbinding(SupportsShouldProcess=$True,ConfirmImpact="Low")] 66 | Param ( 67 | [Parameter(Mandatory=$true,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true)][String]$ModuleName, 68 | [Parameter(Mandatory=$false,ValueFromPipeline=$false,ValueFromPipelineByPropertyName=$true)][switch]$AutoLoad 69 | ) 70 | Begin {} 71 | Process { 72 | [boolean]$Imported = $false 73 | if ((Get-Module -Name $ModuleName) -ne $null) { 74 | Write-Verbose ($ModuleName + " is loaded") 75 | $Imported = $True 76 | } else { 77 | Write-Verbose ($ModuleName + " is not loaded") 78 | if ($AutoLoad.IsPresent) { 79 | if((Get-Module -ListAvailable -verbose:$false | Where-Object { $_.name -like $ModuleName }) -ne $null) { 80 | if ($pscmdlet.ShouldProcess($ModuleName)) { 81 | Import-Module -Name $ModuleName | Out-Null 82 | $Imported = $true 83 | } 84 | } else { 85 | Write-Verbose ($ModuleName + " is not available") 86 | } 87 | } 88 | if ($PSBoundParameters['Verbose']) { 89 | if ((Get-Module -ListAvailable -verbose:$false | Where-Object { $_.Name -eq $ModuleName }) -eq $null) { 90 | Write-Verbose ($ModuleName + " is not available") 91 | } 92 | } 93 | } 94 | $Imported 95 | } 96 | End {} 97 | } 98 | -------------------------------------------------------------------------------- /modules/SushiHangover-Tools/Process-RawPipe.ps1: -------------------------------------------------------------------------------- 1 | Set-StrictMode –Version latest 2 | Function Pipe-Raw 3 | { 4 | <# 5 | .NOTES 6 | Copyright 2012,2013 Robert Nees 7 | Licensed under the Apache License, Version 2.0 (the "License"); 8 | http://sushihangover.blogspot.com 9 | .SYNOPSIS 10 | .DESCRIPTION 11 | Get the standard output of a process so we can 'pipe' it 12 | to another process and avoid PowerShell's object pipe which is not 13 | what you want when you do things like this in CMD.exe or a Linux shell: 14 | Bash >> makepretty -if myface.jpg -of - | findmate -if - -of listofladys.csv 15 | Becomes in PowerShell: 16 | Do-RawPipe makepretty.exe "-if myface.jpg -of -" findmate.exe "-if - -of listofladys.csv" 17 | .EXAMPLE 18 | dir c:\ /s /b | find "LOG" 19 | .EXAMPLE 20 | dir | sort 21 | cat apple.txt | wc 22 | cat apple.txt | sed -e "s/e/J/g" 23 | 24 | .LINK 25 | http://sushihangover.blogspot.com 26 | #> 27 | [CmdletBinding()] 28 | param( 29 | [Parameter(Mandatory=$True)][string] $Process1, 30 | [Parameter(Mandatory=$False)][string] $Args1, 31 | [Parameter(Mandatory=$True)][string] $Process2, 32 | [Parameter(Mandatory=$False)][string] $Args2, 33 | [Parameter(Mandatory=$False)][string] $Working1Path, 34 | [Parameter(Mandatory=$False)][string] $Working2Path, 35 | [Parameter(Mandatory=$False)][int] $BufferSize = 32768 36 | ) 37 | write-output "Building Process 1 startup information" 38 | $process1StartInfo = New-Object System.Diagnostics.ProcessStartInfo 39 | $process1StartInfo.FileName = $Process1 40 | if ($working1Path -gt "") { 41 | $process1StartInfo.WorkingDirectory = $Working1Path 42 | } else { 43 | $process1StartInfo.WorkingDirectory = ((Get-Location).Path) 44 | } 45 | if ($Args1) { 46 | $process1StartInfo.Arguments = $Args1 47 | } 48 | write-output "Building Process 2 startup information" 49 | $process2StartInfo = New-Object System.Diagnostics.ProcessStartInfo 50 | $process2StartInfo.FileName = $Process2 51 | if ($Working2Path -gt "") { 52 | $process2StartInfo.WorkingDirectory = $Working2Path 53 | } else { 54 | $process2StartInfo.WorkingDirectory = ((Get-Location).Path) 55 | } 56 | if ($Args2) { 57 | $process2StartInfo.Arguments = $Args2 58 | } 59 | 60 | try { 61 | $process1StartInfo.UseShellExecute = $True 62 | $process1StartInfo.RedirectStandardInput = $False 63 | $process1StartInfo.RedirectStandardOutput = $True 64 | 65 | $process2StartInfo.UseShellExecute = $false 66 | $process2StartInfo.RedirectStandardInput = $true 67 | $process2StartInfo.RedirectStandardOutput = $false 68 | 69 | write-output "Starting $Process1 process" 70 | $process1StartInfo 71 | $Process1ID = [System.Diagnostics.Process]::Start($process1StartInfo) 72 | write-output "Starting $Process2 process" 73 | $process2ID = [System.Diagnostics.Process]::Start($process2StartInfo) 74 | 75 | $foo = 0 76 | $buffer = new-object char[] $BufferSize 77 | try { 78 | do { 79 | $readCount = $Process1ID.StandardOutput.ReadBLock($buffer, 0, $buffer.Length) 80 | $process2ID.StandardInput.Write($buffer, 0, $readCount) 81 | $process2ID.StandardInput.Flush() 82 | $foo++ 83 | } while ($readCount -gt 0) 84 | } catch { 85 | write-host "ReadBlock Error @ " ((($foo - 1) * $buffer.Length) + $readCount) 86 | } 87 | write-host "$Process1 Std Output Length : " ((($foo) * $buffer.Length) + $readCount) 88 | 89 | Write-Debug "Process2 StdIn close" 90 | $process2.StandardInput.Close() 91 | Write-Debug "Process2 wait for exit" 92 | #$process2.WaitForExit() 93 | if ($process2.HasExited) { 94 | write-debug $Proces2 " Exit Code = " $Processs2ID.ExitCode 95 | } 96 | Write-Debug "Process1 StdOut close" 97 | $process1.StandardOutput.Close() 98 | Write-Debug "Process1 wait for exit" 99 | #$process1.WaitForExit() 100 | if ($process1.HasExited) { 101 | write-debug $Process1 " Exit Code = " $Processs1ID.ExitCode 102 | } 103 | } catch { 104 | write-host "Catch Error and clean up" 105 | # $process2.StandardInput.Flush() 106 | #$process2.StandardInput.Close() 107 | #$process2.Close; $process2.Dispose() 108 | #$process1.StandardInput.Close() 109 | #$process1.Close; $process1.Dispose() 110 | # exit 111 | } 112 | } -------------------------------------------------------------------------------- /modules/SushiHangover-Tools/foobar/Get-RandomString.ps1: -------------------------------------------------------------------------------- 1 | # Get-RandomString.ps1 2 | # Written by Bill Stewart (bstewart@iname.com) 3 | 4 | #requires -version 2 5 | 6 | <# 7 | .SYNOPSIS 8 | Outputs random strings. 9 | 10 | .DESCRIPTION 11 | Outputs one or more random strings containing specified types of characters. 12 | 13 | .PARAMETER Length 14 | Specifies the length of the output string(s). The default value is 8. You cannot specify a value less than 4. 15 | 16 | .PARAMETER LowerCase 17 | Specifies that the string must contain lowercase ASCII characters (default). Specify -LowerCase:$false if you do not want the random string(s) to contain lowercase ASCII characters. 18 | 19 | .PARAMETER UpperCase 20 | Specifies that the string must contain upercase ASCII characters. 21 | 22 | .PARAMETER Numbers 23 | Specifies that the string must contain number characters (0 through 9). 24 | 25 | .PARAMETER Symbols 26 | Specifies that the string must contain typewriter symbol characters. 27 | 28 | .PARAMETER Count 29 | Specifies the number of random strings to output. 30 | 31 | .EXAMPLE 32 | PS C:\> Get-RandomString 33 | Outputs a string containing 8 random lowercase ASCII characters. 34 | 35 | .EXAMPLE 36 | PS C:\> Get-RandomString -Length 14 -Count 5 37 | Outputs 5 random strings containing 14 lowercase ASCII characters each. 38 | 39 | .EXAMPLE 40 | PS C:\> Get-RandomString -UpperCase -LowerCase -Numbers -Count 10 41 | Outputs 10 random 8-character strings containing uppercase, lowercase, and numbers. 42 | 43 | .EXAMPLE 44 | PS C:\> Get-RandomString -Length 32 -LowerCase:$false -Numbers -Symbols -Count 20 45 | Outputs 20 random 32-character strings containing numbers and typewriter symbols. 46 | 47 | .EXAMPLE 48 | PS C:\> Get-RandomString -Length 4 -LowerCase:$false -Numbers -Count 15 49 | Outputs 15 random 4-character strings containing only numbers. 50 | #> 51 | 52 | param( 53 | [UInt32] $Length=8, 54 | [Switch] $LowerCase=$TRUE, 55 | [Switch] $UpperCase=$FALSE, 56 | [Switch] $Numbers=$FALSE, 57 | [Switch] $Symbols=$FALSE, 58 | [Uint32] $Count=1 59 | ) 60 | 61 | if ($Length -lt 4) { 62 | throw "-Length must specify a value greater than 3" 63 | } 64 | 65 | if (-not ($LowerCase -or $UpperCase -or $Numbers -or $Symbols)) { 66 | throw "You must specify one of: -LowerCase -UpperCase -Numbers -Symbols" 67 | } 68 | 69 | # Specifies bitmap values for character sets selected. 70 | $CHARSET_LOWER = 1 71 | $CHARSET_UPPER = 2 72 | $CHARSET_NUMBER = 4 73 | $CHARSET_SYMBOL = 8 74 | 75 | # Creates character arrays for the different character classes, 76 | # based on ASCII character values. 77 | $charsLower = 97..122 | foreach-object { [Char] $_ } 78 | $charsUpper = 65..90 | foreach-object { [Char] $_ } 79 | $charsNumber = 48..57 | foreach-object { [Char] $_ } 80 | $charsSymbol = 35,36,42,43,44,45,46,47,58,59,61,63,64, 81 | 91,92,93,95,123,125,126 | foreach-object { [Char] $_ } 82 | 83 | # Contains the array of characters to use. 84 | $charList = @() 85 | # Contains bitmap of the character sets selected. 86 | $charSets = 0 87 | if ($LowerCase) { 88 | $charList += $charsLower 89 | $charSets = $charSets -bor $CHARSET_LOWER 90 | } 91 | if ($UpperCase) { 92 | $charList += $charsUpper 93 | $charSets = $charSets -bor $CHARSET_UPPER 94 | } 95 | if ($Numbers) { 96 | $charList += $charsNumber 97 | $charSets = $charSets -bor $CHARSET_NUMBER 98 | } 99 | if ($Symbols) { 100 | $charList += $charsSymbol 101 | $charSets = $charSets -bor $CHARSET_SYMBOL 102 | } 103 | 104 | # Returns True if the string contains at least one character 105 | # from the array, or False otherwise. 106 | function test-stringcontents([String] $test, [Char[]] $chars) { 107 | foreach ($char in $test.ToCharArray()) { 108 | if ($chars -ccontains $char) { return $TRUE } 109 | } 110 | return $FALSE 111 | } 112 | 113 | 1..$Count | foreach-object { 114 | # Loops until the string contains at least 115 | # one character from each character class. 116 | do { 117 | # No character classes matched yet. 118 | $flags = 0 119 | $output = "" 120 | # Create output string containing random characters. 121 | 1..$Length | foreach-object { 122 | $output += $charList[(get-random -maximum $charList.Length)] 123 | } 124 | # Check if character classes match. 125 | if ($LowerCase) { 126 | if (test-stringcontents $output $charsLower) { 127 | $flags = $flags -bor $CHARSET_LOWER 128 | } 129 | } 130 | if ($UpperCase) { 131 | if (test-stringcontents $output $charsUpper) { 132 | $flags = $flags -bor $CHARSET_UPPER 133 | } 134 | } 135 | if ($Numbers) { 136 | if (test-stringcontents $output $charsNumber) { 137 | $flags = $flags -bor $CHARSET_NUMBER 138 | } 139 | } 140 | if ($Symbols) { 141 | if (test-stringcontents $output $charsSymbol) { 142 | $flags = $flags -bor $CHARSET_SYMBOL 143 | } 144 | } 145 | } 146 | until ($flags -eq $charSets) 147 | # Output the string. 148 | $output 149 | } 150 | -------------------------------------------------------------------------------- /modules/SushiHangover-Tools/Process-Grep.ps1: -------------------------------------------------------------------------------- 1 | Set-StrictMode –Version latest 2 | function Process-Grep { 3 | <# 4 | .NOTES 5 | Copyright 2012/2013 Robert Nees 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | http://sushihangover.blogspot.com 8 | .SYNOPSIS 9 | *nix style grep 10 | .DESCRIPTION 11 | This script provides a wrapper to give Linux/Grep style cmd line options 12 | Note: It needs a lot of help/work to complete 13 | .EXAMPLE 14 | .LINK 15 | http://sushihangover.blogspot.com 16 | .LINK 17 | https://git.com/sushihangover 18 | #> 19 | [cmdletBinding()] 20 | param( 21 | [Parameter(Mandatory=$False)][Alias("filter")][string]$FilterString, 22 | [Parameter(Mandatory=$False)][Alias("i")][switch]$IgnoreCase, 23 | [Parameter(Mandatory=$False)][Alias("v")][switch]$InvertMatch, 24 | [Parameter(Mandatory=$False)][Alias("A")][int]$AfterContext = 0, 25 | [Parameter(Mandatory=$False)][Alias("B")][int]$BeforeContext = 0, 26 | [Parameter(Mandatory=$False)][Alias("file")][string]$PatternFilename = '', 27 | [Parameter(Mandatory=$False,ValueFromPipeline=$True)][string]$Text = '' 28 | ) 29 | begin { 30 | $LineCount = 0; 31 | Write-Debug "( begin) : Count = $LineCount; filter = $filterString"; 32 | if ($PatternFilename -ne '') { 33 | # Load Patterns from file 34 | } 35 | if ($AfterContext -gt 0) { 36 | $AfterContextCount = 0 37 | $AfterContextArray = new-object System.Collections.Queue ($AfterContext + 1) 38 | } 39 | if ($BeforeContext -gt 0) { 40 | $BeforeContextArray = new-object System.Collections.Queue ($BeforeContext + 1) 41 | } 42 | } 43 | process { 44 | Function OutputMatch { 45 | Write-Output "match $_" 46 | if ($BeforeContext -gt 0) { 47 | #$BeforeContextArray.ToArray() 48 | foreach ($foo in $BeforeContextArray) { 49 | $foo 50 | } 51 | $BeforeContextArray.Clear() 52 | return 53 | } 54 | if ($AfterContext -gt 0) { 55 | #$AfterContextCount++ 56 | #write-output $AfterContextCount 57 | if ($AfterContextCount -eq $AfterContextArray.Count) { 58 | write-output "dequeue match" 59 | #$AfterContextCount-- 60 | #$AfterContextArray.Dequeue() 61 | } else { 62 | #write-output "dequeue match" 63 | #$AfterContextCount-- 64 | # $AfterContextArray.Dequeue() 65 | } 66 | return 67 | } 68 | $_ 69 | } 70 | $LineCount++ 71 | if ($BeforeContext -gt 0) { 72 | if ($BeforeContextArray.Count -gt $BeforeContext) { $foobar = $BeforeContextArray.Dequeue() } 73 | $foobar = $BeforeContextArray.Enqueue($_) 74 | } 75 | if ($AfterContext -gt 0) { 76 | $foobar = $AfterContextArray.Enqueue($_) 77 | Write-Output "enqueue (2) $_" 78 | 79 | # if (($AfterContextArray.Count -gt 0) -and ($AfterContextContext -le $AfterContext)) { 80 | # $AfterContextCount++ 81 | # $foobar = $AfterContextArray.Enqueue($_) 82 | # Write-Output "enqueue (2) $_" 83 | # } 84 | } 85 | if ($IgnoreCase.IsPresent) { 86 | if ( ($_ -cmatch $FilterString ) -and (-not $InvertMatch.IsPresent) ) { 87 | if ($AfterContext -gt 0) {$AfterContextCount++}; OutputMatch $_ 88 | } else { 89 | if ($AfterContext -gt 0) {$AfterContextCount++}; OutputMatch $_ 90 | } 91 | } else { 92 | if ( ( $_ -match $FilterString ) -and (-not $InvertMatch.IsPresent) ) { 93 | if ($AfterContext -gt 0) {$AfterContextCount++}; OutputMatch $_ 94 | } elseif ( ( $_ -notmatch $FilterString ) -and ($InvertMatch.IsPresent) ) { 95 | if ($AfterContext -gt 0) {$AfterContextCount++}; OutputMatch $_ 96 | } 97 | } 98 | #write-output $AfterContextCount 99 | if ($AfterContext -gt 0) { 100 | #write-output $AfterContextCount 101 | #Write-Output $AfterContextArray.Count 102 | if ($AfterContextCount -lt $AfterContextArray.Count) { 103 | #$AfterContextCount-- 104 | $foobar = $AfterContextArray.Dequeue() 105 | Write-Output "dequeued" 106 | } 107 | } 108 | } 109 | end { 110 | if ($AfterContext -gt 0) { 111 | if ($AfterContextArray.Count -gt0) { 112 | Write-Output "dump array" 113 | $AfterContextArray.ToArray() 114 | $AfterContextArray.Clear() 115 | } 116 | } 117 | Write-Debug "( end) : Count = $LineCount; filter = $FilterString"; 118 | if ($AfterContext -gt 0) { 119 | $AfterContextArray.Clear() 120 | $AfterContextArray = $null 121 | } 122 | if ($BeforeContext -gt 0) { 123 | $BeforeContextArray.Clear() 124 | $BeforeContextArray = $null 125 | } 126 | 127 | } 128 | } 129 | -------------------------------------------------------------------------------- /modules/FileSystem/en-us/about_FileSystem_Readme.help.txt: -------------------------------------------------------------------------------- 1 | 2 | NAME 3 | Get-FreeDiskSpace 4 | 5 | SYNOPSIS 6 | Gets the free disk space on logical drives 7 | of the local computer or a remote computer. 8 | 9 | 10 | SYNTAX 11 | Get-FreeDiskSpace [-Drive ] [-SampleInterval ] [-MaxSamples 12 | ] [-Continuous] [-ComputerName ] [] 13 | 14 | 15 | DESCRIPTION 16 | Gets the performance counters values for free disk space, 17 | both in megabytes and as a percentage for all or selected 18 | logical drives of the local computer or a remote computer. 19 | 20 | 21 | RELATED LINKS 22 | Get-Counter 23 | 24 | REMARKS 25 | To see the examples, type: "get-help Get-FreeDiskSpace -examples". 26 | For more information, type: "get-help Get-FreeDiskSpace -detailed". 27 | For technical information, type: "get-help Get-FreeDiskSpace -full". 28 | 29 | NAME 30 | New-Zip 31 | 32 | SYNOPSIS 33 | Creates a new zip archive. 34 | 35 | 36 | SYNTAX 37 | New-Zip [-Path] [-PassThru] [-Force] [] 38 | 39 | 40 | DESCRIPTION 41 | The New-Zip function creates a ZIP archive file (.zip) 42 | with no contents (no compressed files). To add files to 43 | the ZIP archive, use the Copy-ToZip function. 44 | 45 | 46 | RELATED LINKS 47 | Copy-ToZip 48 | 49 | REMARKS 50 | To see the examples, type: "get-help New-Zip -examples". 51 | For more information, type: "get-help New-Zip -detailed". 52 | For technical information, type: "get-help New-Zip -full". 53 | 54 | NAME 55 | Resolve-ShortcutFile 56 | 57 | SYNOPSIS 58 | Resolves an Internet shortcut file to the web site the shortcut references 59 | 60 | 61 | SYNTAX 62 | Resolve-ShortcutFile [[-Filename] ] [] 63 | 64 | 65 | DESCRIPTION 66 | Parses an Internet shortcut file and returns a property bag containing the 67 | shortcut file and the URL it resolves to. 68 | 69 | 70 | RELATED LINKS 71 | Get-Content 72 | Get-Item 73 | Select-Object 74 | Where-Object 75 | 76 | REMARKS 77 | To see the examples, type: "get-help Resolve-ShortcutFile -examples". 78 | For more information, type: "get-help Resolve-ShortcutFile -detailed". 79 | For technical information, type: "get-help Resolve-ShortcutFile -full". 80 | 81 | NAME 82 | Mount-SpecialFolder 83 | 84 | SYNOPSIS 85 | Creates a PSDrive for special folders in the system. 86 | 87 | 88 | SYNTAX 89 | Mount-SpecialFolder [[-Folder] ] [] 90 | 91 | 92 | DESCRIPTION 93 | The Mount-SpecialFolder function creates a Windows 94 | PowerShell drive (PSDrive) for a specified special 95 | folder or all special folders in the system. 96 | 97 | The Mount-SpecialFolder function is run automatically 98 | when you import the FileSystem module. To see the PSDrives 99 | in your session, type "get-psdrive". 100 | 101 | 102 | RELATED LINKS 103 | http://blogs.msdn.com/powershell/archive/2008/12/13/explore-your-environme 104 | nt.aspx 105 | http://msdn.microsoft.com/en-us/library/system.environment.specialfolder.a 106 | spx 107 | Get-PSDrive 108 | New-PSDrive 109 | Remove-PSDrive 110 | 111 | REMARKS 112 | To see the examples, type: "get-help Mount-SpecialFolder -examples". 113 | For more information, type: "get-help Mount-SpecialFolder -detailed". 114 | For technical information, type: "get-help Mount-SpecialFolder -full". 115 | 116 | NAME 117 | Start-FileSystemWatcher 118 | 119 | SYNOPSIS 120 | Starts monitoring for file changes 121 | 122 | 123 | SYNTAX 124 | Start-FileSystemWatcher [-File] [-Filter ] [-Recurse] [-On 125 | ] [-Do ] [] 126 | 127 | 128 | DESCRIPTION 129 | Starts monitoring for file changes using the events on IO.FileSystemWatcher 130 | 131 | 132 | RELATED LINKS 133 | 134 | REMARKS 135 | To see the examples, type: "get-help Start-FileSystemWatcher -examples". 136 | For more information, type: "get-help Start-FileSystemWatcher -detailed". 137 | For technical information, type: "get-help Start-FileSystemWatcher -full". 138 | 139 | NAME 140 | Get-DuplicateFile 141 | 142 | SYNOPSIS 143 | Finds files that have identical file contents. 144 | 145 | 146 | SYNTAX 147 | Get-DuplicateFile [[-Directory] ] [-Recurse] [-HideProgress] [] 149 | 150 | 151 | DESCRIPTION 152 | The Get-DuplicateFile function detects files in a drive 153 | or directory that have identical file content by comparing 154 | an SHA1 cryptographic hash of the file contents. 155 | 156 | 157 | RELATED LINKS 158 | Get-SHA1 159 | 160 | REMARKS 161 | To see the examples, type: "get-help Get-DuplicateFile -examples". 162 | For more information, type: "get-help Get-DuplicateFile -detailed". 163 | For technical information, type: "get-help Get-DuplicateFile -full". 164 | 165 | NAME 166 | Rename-Drive 167 | 168 | SYNOPSIS 169 | Renames a file system drive. 170 | 171 | 172 | SYNTAX 173 | Rename-Drive [[-Drive] ] [[-Name] ] [] 174 | 175 | 176 | DESCRIPTION 177 | The Rename-Drive function provides a new volume name for 178 | a drive on the local computer. 179 | 180 | To use this function, start Windows PowerShell with the "Run as 181 | administrator" option. 182 | 183 | 184 | RELATED LINKS 185 | 186 | REMARKS 187 | To see the examples, type: "get-help Rename-Drive -examples". 188 | For more information, type: "get-help Rename-Drive -detailed". 189 | For technical information, type: "get-help Rename-Drive -full". 190 | 191 | NAME 192 | Get-SHA1 193 | 194 | SYNOPSIS 195 | Computes the SHA1 hash of the specified file. 196 | 197 | 198 | SYNTAX 199 | Get-SHA1 [[-File] ] [] 200 | 201 | 202 | DESCRIPTION 203 | The Get-SHA1 function creates a cryptographic hash of the file 204 | specified in the File parameter by using the SHA1 method. 205 | 206 | 207 | RELATED LINKS 208 | 209 | REMARKS 210 | To see the examples, type: "get-help Get-SHA1 -examples". 211 | For more information, type: "get-help Get-SHA1 -detailed". 212 | For technical information, type: "get-help Get-SHA1 -full". 213 | 214 | NAME 215 | Copy-ToZip 216 | 217 | SYNOPSIS 218 | Compresses files and adds them to a ZIP file. 219 | 220 | 221 | SYNTAX 222 | Copy-ToZip [-File] [-ZipFile] [-HideProgress] [-Force] [< 223 | CommonParameters>] 224 | 225 | 226 | DESCRIPTION 227 | The Copy-ToZip function compresses files and 228 | adds the compressed files to a ZIP archive file. 229 | 230 | If the ZIP file does not exist, this function 231 | creates it. You can also use this function to add 232 | compressed files to a ZIP file that you create by 233 | using the New-Zip function. 234 | 235 | 236 | RELATED LINKS 237 | New-Zip 238 | 239 | REMARKS 240 | To see the examples, type: "get-help Copy-ToZip -examples". 241 | For more information, type: "get-help Copy-ToZip -detailed". 242 | For technical information, type: "get-help Copy-ToZip -full". 243 | 244 | 245 | 246 | -------------------------------------------------------------------------------- /modules/SushiHangover-Tools/MyCredentials.ps1: -------------------------------------------------------------------------------- 1 | Set-StrictMode -Version latest 2 | Function Import-Credential { 3 | <# 4 | .NOTES 5 | Copyright 2012/2013 Robert Nees 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | http://sushihangover.blogspot.com 8 | .SYNOPSIS 9 | Import Windows Credentials from a SecureString based CliXML file 10 | .DESCRIPTION 11 | Import Windows Credentials from a SecureString based CliXML file 12 | 13 | This is 'pipe-able' via the '$Path' PropertyName if need to decode multiple secure credential 14 | files and pass those done the pipeline. 15 | 16 | Note: SecureString encryption, without passing in a key value, would be using a 'key' from the 17 | current user (you!) to encrypt these strings and thus anyone that can log as you (co-worker, 18 | wife, hacker, ...) could use these saved Credentials... 19 | 20 | Note: This function accepts using a SecureString as a Key for the encryption. Review the SecureString 21 | help to determine usage. It is your respondibility to protext that Key (Please do not enter and save it 22 | your script(!!!) as you might as well used Clear Text to begin with) 23 | 24 | Note: ConfirmImpact = High? Yes, you are saving a user's credentials to a file. Even though 25 | this is using Secure Strings in PowerShell you still need to be aware that is can be a 26 | security risk and that a file with credentials will now exist. 27 | 28 | Note: If are working in a 'secure' computing environment, I would highly recommend you not use 29 | these functions, a RSA SSL cert based encryption and decryption based system would be the correct 30 | way to deliver functions like these. In case of suspect access, you can revoke the SSL cert and those 31 | saved cred would be null and void to the hacker. 32 | .EXAMPLE 33 | c:\PS>$orgCred = Get-Credential; $orgCred |Export-Credential -Path 'DeleteMe.clixml' -Confirm:$false; 34 | c:\PS>$newCred = Import-Credential -Path 'DeleteMe.clixml' ; rm DeleteMe.clixml ; Compare-Object $orgCred $newCred -IncludeEqual 35 | 36 | InputObject SideIndicator 37 | ----------- ------------- 38 | System.Management.Automation.PSCredential == 39 | .LINK 40 | http://sushihangover.blogspot.com 41 | .LINK 42 | https://github.com/sushihangover 43 | #> 44 | [cmdletbinding(SupportsShouldProcess=$True,ConfirmImpact="Low")] 45 | Param ( 46 | [Parameter(Mandatory=$true,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true)][String]$Path, 47 | [Parameter(Mandatory=$false)][SecureString]$SecureKey = $null 48 | ) 49 | Begin { 50 | } 51 | Process { 52 | $MyCredential = Import-Clixml $Path 53 | if ($SecureKey -eq $null) { 54 | $Password = $MyCredential.Password | ConvertTo-SecureString 55 | } else { 56 | $Password = $MyCredential.Password | ConvertTo-SecureString -SecureKey $SecureKey 57 | } 58 | $Credential = New-Object System.Management.Automation.PsCredential($MyCredential.UserName,$Password) 59 | return $Credential 60 | } 61 | End { 62 | $Password.Clear(); $Password = $null; 63 | $Credential = $null 64 | } 65 | } 66 | Function Export-Credential { 67 | <# 68 | .NOTES 69 | Copyright 2012/2013 Robert Nees 70 | Licensed under the Apache License, Version 2.0 (the "License"); 71 | http://sushihangover.blogspot.com 72 | .SYNOPSIS 73 | Export Windows Credentials to a SecureString based CliXML file 74 | .DESCRIPTION 75 | This routine saves PSCredentials into a securestring based CliXML file for later 76 | retrieval (Import-Credential). 77 | 78 | Most uses of the Import/Export-Credential involve automating scripts that require 79 | evalavated permissions or scripts that need to be schedule but require different credentials 80 | than one from the scheduler's credentials. 81 | 82 | Note: SecureString encryption, without passing in a key value, would be using a 'key' from the 83 | current user (you!) to encrypt these strings and thus anyone that can log as you (co-worker, 84 | wife, hacker, ...) could use these saved Credentials... 85 | 86 | Note: This function accepts using a SecureString as a Key for the encryption. Review the SecureString 87 | help to determine usage. It is your respondibility to protext that Key (Please do not enter and save it 88 | your script(!!!) as you might as well used Clear Text to begin with) 89 | 90 | Note: ConfirmImpact = High? Yes, you are saving a user's credentials to a file. Even though 91 | this is using Secure Strings in PowerShell you still need to be aware that is can be a 92 | security risk and that a file with credentials will now exist. 93 | 94 | Note: If are working in a 'secure' computing environment, I would highly recommend you not use 95 | these functions, a RSA SSL cert based encryption and decryption based system would be the correct 96 | way to deliver functions like these. In case of suspect access, you can revoke the SSL cert and those 97 | saved cred would be null and void to the hacker. 98 | .EXAMPLE 99 | Get-Credential |Export-Credential -Path 'DeleteMe.clixml' ; cat DeleteMe.clixml ; rm DeleteMe.clixml 100 | 101 | 102 | 103 | 104 | System.Management.Automation.PSCustomObject 105 | System.Object 106 | 107 | 108 | NotTheAdminUser 109 | 01000000d08c9ddf0115d1118c7a00c04fc297eb01000000a9c3a4e550e9274a9c69bdcd573b532100000000020000000 110 | 000106600000001000020000000ac28b591484884c24a1bf55bfa1e7d7fb7031bf4dc94de8e73e7b4b8d8684474000000000e800000000200002000 111 | 0000d335f22af04e5ac73b498432988d22e7727a3d924ec956f6acca7406ef9e89fc200000006d971df42c0644dbc4330feae5fe6b5d87488950f9e 112 | 57ab7c8261283bd71a96240000000d137cfd2bd08a8e343fa29924edb19ca9be245acfd9426c4d5f3c13b1a9ca399bf485c380faecfcbbbb655af1c 113 | 52d302b77e1ff7dbc1b9eb34f0864bc4c7398a 114 | 115 | 116 | 117 | 118 | .LINK 119 | http://sushihangover.blogspot.com 120 | https://github.com/sushihangover 121 | #> 122 | [cmdletbinding(SupportsShouldProcess=$True,ConfirmImpact="High")] 123 | Param ( 124 | [Parameter(Mandatory=$true,ValueFromPipeline=$true)][System.Management.Automation.PsCredential]$Credential, 125 | [Parameter(Mandatory=$true)][String]$Path, 126 | [Parameter(Mandatory=$false)][SecureString]$SecureKey = $null 127 | ) 128 | if ($SecureKey -eq $null) { 129 | $Password = $Credential.Password | ConvertFrom-SecureString 130 | } 131 | if ($pscmdlet.ShouldProcess($Credential.UserName)) { 132 | $MyCredential = New-Object PSOBject 133 | $MyCredential | Add-Member NoteProperty UserName( $Credential.UserName ) 134 | $MyCredential | Add-Member NoteProperty Password( $Password ) 135 | $MyCredential | Export-Clixml $Path 136 | } 137 | } 138 | -------------------------------------------------------------------------------- /modules/SushiHangover-Tools/GZip.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .NOTES 3 | Copyright 2013 Robert Nees 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | .SYNOPSIS 6 | GZip Compress and DeCompress 7 | .DESCRIPTION 8 | A 8k buffered GZip (.gz) Compress and DeCompress functions that support pipelined input 9 | .LINK 10 | http://sushihangover.blogspot.com 11 | .LINK 12 | https://github.com/sushihangover 13 | #> 14 | function Compress-GZip { 15 | <# 16 | .NOTES 17 | Copyright 2013 Robert Nees 18 | Licensed under the Apache License, Version 2.0 (the "License"); 19 | .SYNOPSIS 20 | GZip Compress (.gz) 21 | .DESCRIPTION 22 | A buffered GZip (.gz) Compress function that support pipelined input 23 | .Example 24 | ls .\NotCompressFile.xml | Compress-GZip -Verbose -WhatIf 25 | .Example 26 | Compress-GZip -FullName NotCompressFile.xml -NewName Compressed.xml.funkyextension 27 | .LINK 28 | http://sushihangover.blogspot.com 29 | .LINK 30 | https://github.com/sushihangover 31 | #> 32 | [cmdletbinding(SupportsShouldProcess=$True,ConfirmImpact="Low")] 33 | param ( 34 | [Alias("PSPath")][parameter(mandatory=$true,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true)][string]$FullName, 35 | [Alias("NewName")][parameter(mandatory=$false,ValueFromPipeline=$false,ValueFromPipelineByPropertyName=$true)][string]$GZipPath, 36 | [parameter(mandatory=$false)][switch]$Force 37 | ) 38 | Process { 39 | $_BufferSize = 1024 * 8 40 | if (Test-Path -Path $FullName -PathType Leaf) { 41 | Write-Verbose "Reading from: $FullName" 42 | if ($GZipPath.Length -eq 0) { 43 | $tmpPath = ls -Path $FullName 44 | $GZipPath = Join-Path -Path ($tmpPath.DirectoryName) -ChildPath ($tmpPath.Name + '.gz') 45 | } 46 | if (Test-Path -Path $GZipPath -PathType Leaf -IsValid) { 47 | Write-Verbose "Compressing to: $GZipPath" 48 | } else { 49 | Write-Error -Message "$FullName is not a valid path/file" 50 | return 51 | } 52 | } else { 53 | Write-Error -Message "$GZipPath does not exist" 54 | return 55 | } 56 | if (Test-Path -Path $GZipPath -PathType Leaf) { 57 | If ($Force.IsPresent) { 58 | if ($pscmdlet.ShouldProcess("Overwrite Existing File @ $GZipPath")) { 59 | Touch-File $GZipPath 60 | } 61 | } 62 | } else { 63 | if ($pscmdlet.ShouldProcess("Create new Compressed File @ $GZipPath")) { 64 | Touch-File $GZipPath 65 | } 66 | } 67 | if ($pscmdlet.ShouldProcess("Creating Compress File @ $GZipPath")) { 68 | Write-Verbose "Opening streams and file to save compressed version to..." 69 | $input = New-Object System.IO.FileStream (ls -path $FullName).FullName, ([IO.FileMode]::Open), ([IO.FileAccess]::Read), ([IO.FileShare]::Read); 70 | $output = New-Object System.IO.FileStream (ls -path $GZipPath).FullName, ([IO.FileMode]::Create), ([IO.FileAccess]::Write), ([IO.FileShare]::None) 71 | $gzipStream = New-Object System.IO.Compression.GzipStream $output, ([IO.Compression.CompressionMode]::Compress) 72 | try { 73 | $buffer = New-Object byte[]($_BufferSize); 74 | while ($true) { 75 | $read = $input.Read($buffer, 0, ($_BufferSize)) 76 | if ($read -le 0) { 77 | break; 78 | } 79 | $gzipStream.Write($buffer, 0, $read) 80 | } 81 | } 82 | finally { 83 | Write-Verbose "Closing streams and newly compressed file" 84 | $gzipStream.Close(); 85 | $output.Close(); 86 | $input.Close(); 87 | } 88 | } 89 | } 90 | } 91 | function Expand-GZip { 92 | <# 93 | .NOTES 94 | Copyright 2013 Robert Nees 95 | Licensed under the Apache License, Version 2.0 (the "License"); 96 | .SYNOPSIS 97 | GZip Decompress (.gz) 98 | .DESCRIPTION 99 | A buffered GZip (.gz) Decompress function that support pipelined input 100 | .Example 101 | ls .\RegionName.cs.gz | Expand-GZip -Verbose -WhatIf 102 | .Example 103 | Expand-GZip -FullName CompressFile.xml.gz -NewName NotCompressed.xml 104 | .LINK 105 | http://sushihangover.blogspot.com 106 | .LINK 107 | https://github.com/sushihangover 108 | #> 109 | [cmdletbinding(SupportsShouldProcess=$True,ConfirmImpact="Low")] 110 | param ( 111 | [Alias("PSPath")][parameter(mandatory=$true,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true)][string]$FullName, 112 | [Alias("NewName")][parameter(mandatory=$false,ValueFromPipeline=$false,ValueFromPipelineByPropertyName=$true)][string]$GZipPath = $null, 113 | [parameter(mandatory=$false)][switch]$Force 114 | ) 115 | Process { 116 | if (Test-Path -Path $FullName -PathType Leaf) { 117 | Write-Verbose "Reading from: $FullName" 118 | if ($GZipPath.Length -eq 0) { 119 | $tmpPath = ls -Path $FullName 120 | $GZipPath = Join-Path -Path ($tmpPath.DirectoryName) -ChildPath ($tmpPath.BaseName) 121 | } 122 | if (Test-Path -Path $GZipPath -PathType Leaf -IsValid) { 123 | Write-Verbose "Decompressing to: $GZipPath" 124 | } else { 125 | Write-Error -Message "$GZipPath is not a valid path/file" 126 | return 127 | } 128 | } else { 129 | Write-Error -Message "$FullName does not exist" 130 | return 131 | } 132 | if (Test-Path -Path $GZipPath -PathType Leaf) { 133 | If ($Force.IsPresent) { 134 | if ($pscmdlet.ShouldProcess("Overwrite Existing File @ $GZipPath")) { 135 | Touch-File $GZipPath 136 | } 137 | } 138 | } else { 139 | if ($pscmdlet.ShouldProcess("Create new decompressed File @ $GZipPath")) { 140 | Touch-File $GZipPath 141 | } 142 | } 143 | if ($pscmdlet.ShouldProcess("Creating Decompressed File @ $GZipPath")) { 144 | Write-Verbose "Opening streams and file to save compressed version to..." 145 | $input = New-Object System.IO.FileStream (ls -path $FullName).FullName, ([IO.FileMode]::Open), ([IO.FileAccess]::Read), ([IO.FileShare]::Read); 146 | $output = New-Object System.IO.FileStream (ls -path $GZipPath).FullName, ([IO.FileMode]::Create), ([IO.FileAccess]::Write), ([IO.FileShare]::None) 147 | $gzipStream = New-Object System.IO.Compression.GzipStream $input, ([IO.Compression.CompressionMode]::Decompress) 148 | try { 149 | $buffer = New-Object byte[](1024); 150 | while ($true) { 151 | $read = $gzipStream.Read($buffer, 0, 1024) 152 | if ($read -le 0) { 153 | break; 154 | } 155 | $output.Write($buffer, 0, $read) 156 | } 157 | } 158 | finally { 159 | Write-Verbose "Closing streams and newly decompressed file" 160 | $gzipStream.Close(); 161 | $output.Close(); 162 | $input.Close(); 163 | } 164 | } 165 | } 166 | } 167 | -------------------------------------------------------------------------------- /modules/SushiHangover-RSACrypto/SushiHangover-RSACrypto.psm1: -------------------------------------------------------------------------------- 1 | Set-StrictMode –Version latest 2 | <# 3 | .NOTES 4 | Copyright 2012/2013 Robert Nees 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | http://sushihangover.blogspot.com 7 | .SYNOPSIS 8 | RSA Private Key encrypt and decrypt functions 9 | .DESCRIPTION 10 | This is a collection of functions that provide a wrapper to 'opensslkey.cs' 11 | 12 | Note: The source code in opensslkey.cs: 13 | Copyright (C) 2008 JavaScience Consulting (See header for full details) 14 | I did make edits to the C# code but hold no copyright on it. 15 | 16 | The opesslkey.cs works via Add-Type with .Net 4.5 under Windows 8 / PowerShell 3.0 17 | without any issues that I have seen. 18 | .EXAMPLE 19 | Import-Module SushiHangover-RSACrypnto 20 | $PemFile = $HOME + '\.ssh\SSH2RSA2048_private_test_key.pem' 21 | . Set-RSACryptoServiceProvider $PemFile 22 | $preclearText = "Hello, Lets keep this a secret, OK?" 23 | Write-Host 'Clear Text of:' 24 | Write-Host '--------------' 25 | Write-Host $preclearText 26 | Write-Host '------------------------------------------------' 27 | Write-Host 'Becomes Encrypted and viewed as a Base64 String:' 28 | Write-Host '------------------------------------------------' 29 | $clearBytes = Convert-StringToByte $preclearText 30 | $clearBase64 = ConvertTo-Base64String $clearBytes 31 | $cypherBytes = Get-RSAEncryptedBytes $clearBase64 $false 32 | $cypherBase64 = ConvertTo-Base64String $cypherBytes 33 | Write-Host 'Encrypted Base64 String:' 34 | Write-Host '------------------------' 35 | $cypherBase64 36 | # The multiple step way using byte output 37 | $clearBytes = Get-RSAClearBytes $cypherBase64 $false 38 | $postclearText = Convert-ByteToString $clearBytes 39 | Compare-Object $preclearText $postclearText -CaseSensitive -IncludeEqual 40 | # Or convert directly to clear text 41 | $postclearText = Get-RSAClearText $cypherBase64 $false 42 | Compare-Object $preclearText $postclearText -CaseSensitive -IncludeEqual 43 | Remove-Module SushiHangover-RSACrypto 44 | .LINK 45 | http://sushihangover.blogspot.com 46 | .LINK 47 | http://ruudvanderlinden.com/2010/10/19/running-inline-c-with-custom-assemblies-in-powershell-2-0/ 48 | .LINK 49 | http://blogs.technet.com/b/stefan_gossner/archive/2010/05/07/using-csharp-c-code-in-powershell-scripts.aspx 50 | .LINK 51 | http://msdn.microsoft.com/en-us/library/system.security.cryptography.rsacryptoserviceprovider.aspx 52 | #> 53 | $CSFile = Join-Path -Path $PSScriptRoot -ChildPath 'opensslkey.cs’ 54 | $SourceCode = [System.IO.File]::ReadAllText($CSFile) 55 | $Assemblies = ('System','System.Security') 56 | 57 | try { 58 | Add-Type -TypeDefinition $SourceCode -ReferencedAssemblies $Assemblies -IgnoreWarnings -Language CSharp 59 | } catch { 60 | Write-Warning "An error occurred attempting to add the .NET Framework class to the PowerShell session." 61 | Write-Warning "The error was: $($Error[0].Exception.Message)" 62 | } 63 | 64 | Function ConvertTo-Base64String { 65 | Param ( 66 | [Parameter(Mandatory=$true)][Alias('pem')][array]$ByteString 67 | ) 68 | return [System.Convert]::ToBase64String($ByteString) 69 | } 70 | Export-ModuleMember -function ConvertTo-Base64String 71 | 72 | Function ConvertFrom-Base64String { 73 | Param ( 74 | [Parameter(Mandatory=$true)][Alias('pem')][string]$ByteString 75 | ) 76 | return [System.Convert]::FromBase64String($ByteString) 77 | } 78 | Export-ModuleMember -function ConvertFrom-Base64String 79 | 80 | Function Convert-ByteToString { 81 | Param ( 82 | [Parameter(Mandatory=$true)][Alias('byte')][byte[]]$AsciiByteArray 83 | ) 84 | return [System.Text.Encoding]::ASCII.GetString($AsciiByteArray) 85 | } 86 | Export-ModuleMember -function Convert-ByteToString 87 | 88 | Function Convert-StringToByte { 89 | Param ( 90 | [Parameter(Mandatory=$true)][Alias('byte')][string]$AsciiByteString 91 | ) 92 | return [System.Text.Encoding]::ASCII.GetBytes($AsciiByteString) 93 | } 94 | Export-ModuleMember -function Convert-StringToByte 95 | 96 | Function Set-RSACryptoServiceProvider { 97 | Param ( 98 | [Parameter(Mandatory=$true)][Alias('pem')][Alias('p')][string]$PemPrivateKeyFile 99 | ) 100 | if (Test-Path -Path $PemPrivateKeyFile) { 101 | Write-Debug "Pem file exists" 102 | $PemText = [System.IO.File]::ReadAllText($PemPrivateKeyFile) 103 | Write-Debug $PemText 104 | $PemPrivateKey = [javascience.opensslkey]::DecodeOpenSSLPrivateKey($PemText) 105 | [System.Security.Cryptography.RSACryptoServiceProvider]$RSA = [javascience.opensslkey]::DecodeRSAPrivateKey($PemPrivateKey); 106 | Write-Debug $RSA 107 | } else { 108 | Write-Debug "PEM File does not exist" 109 | $RSA = $null 110 | } 111 | new-variable -scope global -name RSACryptoServiceProvider -force 112 | $RSACryptoServiceProvider = $RSA 113 | } 114 | Export-ModuleMember -function Set-RSACryptoServiceProvider 115 | 116 | Function Get-RSACryptoServiceProvider { 117 | if (!$RSACryptoServiceProvider) { 118 | . Set-RSACryptoServiceProvider 119 | } 120 | return $RSACryptoServiceProvider 121 | } 122 | Export-ModuleMember -function Get-RSACryptoServiceProvider 123 | 124 | Function Get-RSAClearBytes { 125 | <# 126 | .SYNOPSIS 127 | RSA Decryption to Bytes with optional OAEP padding 128 | .Parameter OAEPPadding 129 | True to perform direct RSA decryption using OAEP padding (only available on a computer 130 | running Microsoft Windows XP or later); otherwise, false to use PKCS#1 v1.5 padding. 131 | .Parameter out 132 | Returns Decrypted Base64 String 133 | #> 134 | Param ( 135 | [Parameter(Mandatory=$true)][Alias('cypher')][string]$CypherBase64, 136 | [Parameter(Mandatory=$true)][Alias('oaep')][boolean]$OAEPPadding = $false, 137 | [Parameter(Mandatory=$false)][Alias('RSA')][System.Security.Cryptography.RSACryptoServiceProvider]$RSACryptoServiceProvider = (. Get-RSACryptoServiceProvider) 138 | ) 139 | $CypherBytes = [System.Convert]::FromBase64String($CypherBase64) 140 | $ClearBytes = $RSACryptoServiceProvider.Decrypt($CypherBytes, $OAEPPadding) 141 | Return $ClearBytes 142 | } 143 | Export-ModuleMember -function Get-RSAClearBytes 144 | 145 | Function Get-RSAClearText { 146 | <# 147 | .SYNOPSIS 148 | RSA Decryption to ClearText with optional OAEP padding 149 | .Parameter OAEPPadding 150 | True to perform direct RSA decryption using OAEP padding (only available on a computer 151 | running Microsoft Windows XP or later); otherwise, false to use PKCS#1 v1.5 padding. 152 | .Parameter out 153 | Returns Decrypted "Clear Text" String 154 | #> 155 | Param ( 156 | [Parameter(Mandatory=$true)][Alias('cypher')][string]$CypherBase64, 157 | [Parameter(Mandatory=$true)][Alias('oaep')][boolean]$OAEPPadding = $false, 158 | [Parameter(Mandatory=$false)][Alias('RSA')][System.Security.Cryptography.RSACryptoServiceProvider]$RSACryptoServiceProvider = (. Get-RSACryptoServiceProvider) 159 | ) 160 | $clearBytes = Get-RSAClearBytes $CypherBase64 $OAEPPadding 161 | Return Convert-ByteToString $clearBytes 162 | } 163 | Export-ModuleMember -function Set-RSAEncryptedBytes 164 | 165 | Function Get-RSAEncryptedBytes { 166 | Param ( 167 | [Parameter(Mandatory=$true)][Alias('cypher')][array]$ClearBase64, 168 | [Parameter(Mandatory=$true)][Alias('oaep')][boolean]$OAEPPadding = $false, 169 | [Parameter(Mandatory=$false)][Alias('RSA')][System.Security.Cryptography.RSACryptoServiceProvider]$RSACryptoServiceProvider = (. Get-RSACryptoServiceProvider) 170 | ) 171 | $ClearBytes = [System.Convert]::FromBase64String($ClearBase64) 172 | $CypherBytes = $RSACryptoServiceProvider.Encrypt($ClearBytes, $OAEPPadding) 173 | #$CypherString = [System.Text.Encoding]::ASCII.GetString($CypherBytes) 174 | Return $CypherBytes 175 | } 176 | Export-ModuleMember -function Get-RSAEncryptedBytes 177 | 178 | -------------------------------------------------------------------------------- /modules/SushiHangover-Tools/ClearIECache.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Runtime.InteropServices; 6 | 7 | namespace SushiHangover 8 | { 9 | // Class for deleting the cache. 10 | public class ClearIECache 11 | { 12 | // For PInvoke: Contains information about an entry in the Internet cache 13 | [StructLayout(LayoutKind.Explicit, Size = 80)] 14 | public struct INTERNET_CACHE_ENTRY_INFOA 15 | { 16 | [FieldOffset(0)] 17 | public uint dwStructSize; 18 | [FieldOffset(4)] 19 | public IntPtr lpszSourceUrlName; 20 | [FieldOffset(8)] 21 | public IntPtr lpszLocalFileName; 22 | [FieldOffset(12)] 23 | public uint CacheEntryType; 24 | [FieldOffset(16)] 25 | public uint dwUseCount; 26 | [FieldOffset(20)] 27 | public uint dwHitRate; 28 | [FieldOffset(24)] 29 | public uint dwSizeLow; 30 | [FieldOffset(28)] 31 | public uint dwSizeHigh; 32 | [FieldOffset(32)] 33 | public FILETIME LastModifiedTime; 34 | [FieldOffset(40)] 35 | public FILETIME ExpireTime; 36 | [FieldOffset(48)] 37 | public FILETIME LastAccessTime; 38 | [FieldOffset(56)] 39 | public FILETIME LastSyncTime; 40 | [FieldOffset(64)] 41 | public IntPtr lpHeaderInfo; 42 | [FieldOffset(68)] 43 | public uint dwHeaderInfoSize; 44 | [FieldOffset(72)] 45 | public IntPtr lpszFileExtension; 46 | [FieldOffset(76)] 47 | public uint dwReserved; 48 | [FieldOffset(76)] 49 | public uint dwExemptDelta; 50 | } 51 | 52 | // For PInvoke: Initiates the enumeration of the cache groups in the Internet cache 53 | [DllImport(@"wininet", 54 | SetLastError = true, 55 | CharSet = CharSet.Auto, 56 | EntryPoint = "FindFirstUrlCacheGroup", 57 | CallingConvention = CallingConvention.StdCall)] 58 | public static extern IntPtr FindFirstUrlCacheGroup( 59 | int dwFlags, 60 | int dwFilter, 61 | IntPtr lpSearchCondition, 62 | int dwSearchCondition, 63 | ref long lpGroupId, 64 | IntPtr lpReserved); 65 | 66 | // For PInvoke: Retrieves the next cache group in a cache group enumeration 67 | [DllImport(@"wininet", 68 | SetLastError = true, 69 | CharSet = CharSet.Auto, 70 | EntryPoint = "FindNextUrlCacheGroup", 71 | CallingConvention = CallingConvention.StdCall)] 72 | public static extern bool FindNextUrlCacheGroup( 73 | IntPtr hFind, 74 | ref long lpGroupId, 75 | IntPtr lpReserved); 76 | 77 | // For PInvoke: Releases the specified GROUPID and any associated state in the cache index file 78 | [DllImport(@"wininet", 79 | SetLastError = true, 80 | CharSet = CharSet.Auto, 81 | EntryPoint = "DeleteUrlCacheGroup", 82 | CallingConvention = CallingConvention.StdCall)] 83 | public static extern bool DeleteUrlCacheGroup( 84 | long GroupId, 85 | int dwFlags, 86 | IntPtr lpReserved); 87 | 88 | // For PInvoke: Begins the enumeration of the Internet cache 89 | [DllImport(@"wininet", 90 | SetLastError = true, 91 | CharSet = CharSet.Auto, 92 | EntryPoint = "FindFirstUrlCacheEntryA", 93 | CallingConvention = CallingConvention.StdCall)] 94 | public static extern IntPtr FindFirstUrlCacheEntry( 95 | [MarshalAs(UnmanagedType.LPTStr)] string lpszUrlSearchPattern, 96 | IntPtr lpFirstCacheEntryInfo, 97 | ref int lpdwFirstCacheEntryInfoBufferSize); 98 | 99 | // For PInvoke: Retrieves the next entry in the Internet cache 100 | [DllImport(@"wininet", 101 | SetLastError = true, 102 | CharSet = CharSet.Auto, 103 | EntryPoint = "FindNextUrlCacheEntryA", 104 | CallingConvention = CallingConvention.StdCall)] 105 | public static extern bool FindNextUrlCacheEntry( 106 | IntPtr hFind, 107 | IntPtr lpNextCacheEntryInfo, 108 | ref int lpdwNextCacheEntryInfoBufferSize); 109 | 110 | // For PInvoke: Removes the file that is associated with the source name from the cache, if the file exists 111 | [DllImport(@"wininet", 112 | SetLastError = true, 113 | CharSet = CharSet.Auto, 114 | EntryPoint = "DeleteUrlCacheEntryA", 115 | CallingConvention = CallingConvention.StdCall)] 116 | public static extern bool DeleteUrlCacheEntry( 117 | IntPtr lpszUrlName); 118 | 119 | public void Clear() 120 | { 121 | // Indicates that all of the cache groups in the user's system should be enumerated 122 | const int CACHEGROUP_SEARCH_ALL = 0x0; 123 | // Indicates that all the cache entries that are associated with the cache group 124 | // should be deleted, unless the entry belongs to another cache group. 125 | const int CACHEGROUP_FLAG_FLUSHURL_ONDELETE = 0x2; 126 | // File not found. 127 | const int ERROR_FILE_NOT_FOUND = 0x2; 128 | // No more items have been found. 129 | const int ERROR_NO_MORE_ITEMS = 259; 130 | // Pointer to a GROUPID variable 131 | long groupId = 0; 132 | 133 | // Local variables 134 | int cacheEntryInfoBufferSizeInitial = 0; 135 | int cacheEntryInfoBufferSize = 0; 136 | IntPtr cacheEntryInfoBuffer = IntPtr.Zero; 137 | INTERNET_CACHE_ENTRY_INFOA internetCacheEntry; 138 | IntPtr enumHandle = IntPtr.Zero; 139 | bool returnValue = false; 140 | 141 | // Delete the groups first. 142 | // Groups may not always exist on the system. 143 | // For more information, visit the following Microsoft Web site: 144 | // http://msdn.microsoft.com/library/?url=/workshop/networking/wininet/overview/cache.asp 145 | // By default, a URL does not belong to any group. Therefore, that cache may become 146 | // empty even when the CacheGroup APIs are not used because the existing URL does not belong to any group. 147 | enumHandle = FindFirstUrlCacheGroup(0, CACHEGROUP_SEARCH_ALL, IntPtr.Zero, 0, ref groupId, IntPtr.Zero); 148 | // If there are no items in the Cache, you are finished. 149 | if (enumHandle != IntPtr.Zero && ERROR_NO_MORE_ITEMS == Marshal.GetLastWin32Error()) 150 | return; 151 | 152 | // Loop through Cache Group, and then delete entries. 153 | while (true) 154 | { 155 | // Delete a particular Cache Group. 156 | returnValue = DeleteUrlCacheGroup(groupId, CACHEGROUP_FLAG_FLUSHURL_ONDELETE, IntPtr.Zero); 157 | if (!returnValue && ERROR_FILE_NOT_FOUND == Marshal.GetLastWin32Error()) 158 | { 159 | returnValue = FindNextUrlCacheGroup(enumHandle, ref groupId, IntPtr.Zero); 160 | } 161 | 162 | if (!returnValue && (ERROR_NO_MORE_ITEMS == Marshal.GetLastWin32Error() || ERROR_FILE_NOT_FOUND == Marshal.GetLastWin32Error())) 163 | break; 164 | } 165 | 166 | // Start to delete URLs that do not belong to any group. 167 | enumHandle = FindFirstUrlCacheEntry(null, IntPtr.Zero, ref cacheEntryInfoBufferSizeInitial); 168 | if (enumHandle == IntPtr.Zero && ERROR_NO_MORE_ITEMS == Marshal.GetLastWin32Error()) 169 | return; 170 | 171 | cacheEntryInfoBufferSize = cacheEntryInfoBufferSizeInitial; 172 | cacheEntryInfoBuffer = Marshal.AllocHGlobal(cacheEntryInfoBufferSize); 173 | enumHandle = FindFirstUrlCacheEntry(null, cacheEntryInfoBuffer, ref cacheEntryInfoBufferSizeInitial); 174 | 175 | while (true) 176 | { 177 | internetCacheEntry = (INTERNET_CACHE_ENTRY_INFOA)Marshal.PtrToStructure(cacheEntryInfoBuffer, typeof(INTERNET_CACHE_ENTRY_INFOA)); 178 | 179 | cacheEntryInfoBufferSizeInitial = cacheEntryInfoBufferSize; 180 | returnValue = DeleteUrlCacheEntry(internetCacheEntry.lpszSourceUrlName); 181 | if (!returnValue) 182 | { 183 | returnValue = FindNextUrlCacheEntry(enumHandle, cacheEntryInfoBuffer, ref cacheEntryInfoBufferSizeInitial); 184 | } 185 | if (!returnValue && ERROR_NO_MORE_ITEMS == Marshal.GetLastWin32Error()) 186 | { 187 | break; 188 | } 189 | if (!returnValue && cacheEntryInfoBufferSizeInitial > cacheEntryInfoBufferSize) 190 | { 191 | cacheEntryInfoBufferSize = cacheEntryInfoBufferSizeInitial; 192 | cacheEntryInfoBuffer = Marshal.ReAllocHGlobal(cacheEntryInfoBuffer, (IntPtr)cacheEntryInfoBufferSize); 193 | returnValue = FindNextUrlCacheEntry(enumHandle, cacheEntryInfoBuffer, ref cacheEntryInfoBufferSizeInitial); 194 | } 195 | } 196 | Marshal.FreeHGlobal(cacheEntryInfoBuffer); 197 | } 198 | } 199 | } 200 | -------------------------------------------------------------------------------- /modules/SushiHangover-Tools/Get-GeoIP.ps1: -------------------------------------------------------------------------------- 1 | Set-StrictMode –Version latest 2 | <# 3 | .NOTES 4 | Copyright 2013 Robert Nees 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | .SYNOPSIS 7 | MaxMind GeoIP Database Interface 8 | .DESCRIPTION 9 | MaxMind GeoIP Database Interface 10 | .LINK 11 | http://sushihangover.blogspot.com 12 | .LINK 13 | https://github.com/sushihangover 14 | .LINK 15 | http://dev.maxmind.com/geoip/geolite 16 | #> 17 | Function Expand-GeoIPDatabase { 18 | <# 19 | .NOTES 20 | Copyright 2013 Robert Nees 21 | Licensed under the Apache License, Version 2.0 (the "License"); 22 | .SYNOPSIS 23 | Expand your MaxMind GeoIP Free Databases 24 | .DESCRIPTION 25 | Expand your MaxMind GeoIP Free [Parameter(Mandatory=$true,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true)][String]$Path, 26 | Databases. Normally callled by Refresh-GeoIPDatabase, but if you manually download 27 | the datbases you can use this to decompass the '.gz' files 28 | .EXAMPLE 29 | C:\PS>Expand-GeoIPDatabase 30 | #> 31 | [cmdletbinding(SupportsShouldProcess=$True,ConfirmImpact="Low")] 32 | 33 | $MaxMindDBLocation = Join-Path -Path $PSScriptRoot -ChildPath "MaxMindGeoIpDB" 34 | $DBList = ls -path $MaxMindDBLocation -Filter '*.gz' 35 | if ($pscmdlet.ShouldProcess("Decompress the MaxMind GEoIp Database located at $MaxMindDBLocation")) { 36 | $DBList | Expand-GZip -verbose 37 | } 38 | } 39 | Function Refresh-GeoIpDatabase { 40 | <# 41 | .NOTES 42 | Copyright 2013 Robert Nees 43 | Licensed under the Apache License, Version 2.0 (the "License"); 44 | .SYNOPSIS 45 | Download/Refresh your MaxMind GeoIP Free Databases 46 | .DESCRIPTION 47 | Download/Refresh your MaxMind GeoIP Free Databases 48 | .EXAMPLE 49 | C:\PS>Refresh-GeoIPDatabase 50 | #> 51 | [cmdletbinding(SupportsShouldProcess=$True,ConfirmImpact="Low")] 52 | Param ( 53 | ) 54 | $MaxMindGeoIP = @( 55 | 'http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz', 56 | 'http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz', 57 | 'http://download.maxmind.com/download/geoip/database/asnum/GeoIPASNum.dat.gz' 58 | ) 59 | $MaxMindDBLocation = Join-Path -Path $PSScriptRoot -ChildPath "MaxMindGeoIpDB" 60 | if (!(Test-Path -Path $MaxMindDBLocation)) { 61 | if ($pscmdlet.ShouldProcess("Create MAxMind Database Directory @ $MaxMindDBLocation")) { 62 | New-Item -ItemType Directory -Path $MaxMindDBLocation | Out-Null 63 | } 64 | } 65 | if ($pscmdlet.ShouldProcess("Connect to MaxMind Webiste")) { 66 | $foobar = Invoke-WebRequest -Uri http://dev.maxmind.com/geoip/geolite 67 | ForEach ($url in $MaxMindGeoIP) { 68 | if ($pscmdlet.ShouldProcess("Download : $url")) { 69 | Start-BitsTransfer -Source $url -Destination $MaxMindDBLocation 70 | } 71 | } 72 | if ($pscmdlet.ShouldProcess("Decompress Databsases")) { 73 | ls -path $MaxMindDBLocation -Filter '*.gz' | Expand-GZip -verbose 74 | } 75 | } 76 | } 77 | Function Get-GeoIpCity { 78 | <# 79 | .NOTES 80 | Copyright 2013 Robert Nees 81 | Licensed under the Apache License, Version 2.0 (the "License"); 82 | http://sushihangover.blogspot.com 83 | .SYNOPSIS 84 | .DESCRIPTION 85 | .EXAMPLE 86 | C:\PS>Resolve-Host Microsoft.com | Get-GeoIpCity 87 | Redmond 88 | C:\PS>Resolve-Host Google.com | Get-GeoIpCity 89 | Mountain View 90 | .EXAMPLE 91 | C:\PS>$MyHomeTownIP | Get-GeoIpCity 92 | Kirkland 93 | .LINK 94 | http://sushihangover.blogspot.com 95 | .LINK 96 | https://github.com/sushihangover 97 | #> 98 | Param ( 99 | [Parameter(Mandatory=$true,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true)][String]$IPAddress 100 | ) 101 | Begin { 102 | if (!(Test-AssemblyLoaded -AssemblyName SushiHangover.GeoIP.LookupService)) { 103 | Import-GeoIP 104 | } 105 | $CityIPDatabasePath = Join-Path -Path $PSScriptRoot -ChildPath 'MaxMindGeoIpDB\GeoLiteCity.dat’ 106 | $CityIPDatabase = ls $CityIPDatabasePath 107 | $geoip = New-Object SushiHangover.GeoIP.LookupService($CityIPDatabase.FullName, [SushiHangover.GeoIP.LookupService]::GEOIP_STANDARD) 108 | } 109 | Process { 110 | ($geoip.getLocation($IPAddress)).City 111 | } 112 | End { 113 | } 114 | } 115 | Function Get-GeoIpLocation { 116 | <# 117 | .NOTES 118 | Copyright 2013 Robert Nees 119 | Licensed under the Apache License, Version 2.0 (the "License"); 120 | http://sushihangover.blogspot.com 121 | .SYNOPSIS 122 | Returns a full GeoIP location object 123 | .DESCRIPTION 124 | Returns the full GeoIP location object on the pipeline 125 | 126 | TypeName: SushiHangover.GeoIP.Location 127 | Name MemberType Definition 128 | ---- ---------- ---------- 129 | distance Method double distance(SushiHangover.GeoIP.Location loc) 130 | Equals Method bool Equals(System.Object obj) 131 | GetHashCode Method int GetHashCode() 132 | GetType Method type GetType() 133 | ToString Method string ToString() 134 | area_code Property int area_code {get;set;} 135 | city Property string city {get;set;} 136 | countryCode Property string countryCode {get;set;} 137 | countryName Property string countryName {get;set;} 138 | dma_code Property int dma_code {get;set;} 139 | latitude Property double latitude {get;set;} 140 | longitude Property double longitude {get;set;} 141 | metro_code Property int metro_code {get;set;} 142 | postalCode Property string postalCode {get;set;} 143 | region Property string region {get;set;} 144 | regionName Property string regionName {get;set;} 145 | .EXAMPLE 146 | .EXAMPLE 147 | Resolve-Host google.com -PassThru | Select-Object -ExpandProperty AddressList |Select-Object -ExpandProperty ` 148 | IPAddressToString|Get-GeoIpLocation | Select-Object -Property postalCode,regionName,city -Unique|ft -AutoSize 149 | 150 | postalCode regionName city 151 | ---------- ---------- ---- 152 | 94043 California Mountain View 153 | .LINK 154 | http://sushihangover.blogspot.com 155 | .LINK 156 | https://github.com/sushihangover 157 | #> 158 | Param ( 159 | [Parameter(Mandatory=$true,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true)][String]$IPAddress 160 | ) 161 | Begin { 162 | if (!(Test-AssemblyLoaded -AssemblyName SushiHangover.GeoIP.LookupService)) { 163 | Import-GeoIP 164 | } 165 | $CityIPDatabasePath = Join-Path -Path $PSScriptRoot -ChildPath 'MaxMindGeoIpDB\GeoLiteCity.dat’ 166 | $CityIPDatabase = ls $CityIPDatabasePath 167 | $geoip = New-Object SushiHangover.GeoIP.LookupService($CityIPDatabase.FullName, [SushiHangover.GeoIP.LookupService]::GEOIP_STANDARD) 168 | } 169 | Process { 170 | ($geoip.getLocation($IPAddress)) 171 | } 172 | End { 173 | } 174 | } 175 | Function Get-GeoIpASN { 176 | <# 177 | .NOTES 178 | Copyright 2013 Robert Nees 179 | Licensed under the Apache License, Version 2.0 (the "License"); 180 | http://sushihangover.blogspot.com 181 | .SYNOPSIS 182 | .DESCRIPTION 183 | Autonomous Systems are routable networks within the public Internet, administered by the local RIRs 184 | and assigned to owners of networks. The ASN Information tool displays information about an IP address's 185 | Autonomous System Number (ASN) such as: IP owner, registration date, issuing registrar and the max range 186 | of the AS with total IPs. 187 | .EXAMPLE 188 | $MyHomeTownIP | Get-GeoIpASN 189 | 190 | AS5650 Frontier Communications of America, Inc. 191 | .EXAMPLE 192 | C:\PS>Get-GeoIpASN -IPAddress 157.55.33.14 193 | 194 | AS8075 Microsoft Corp 195 | .EXAMPLE 196 | C:\PS>Resolve-Host -ComputerName google.com -Count -1 | Get-GeoIpASN 197 | AS15169 Google Inc. 198 | AS15169 Google Inc. 199 | AS15169 Google Inc. 200 | AS15169 Google Inc. 201 | AS15169 Google Inc. 202 | AS15169 Google Inc. 203 | AS15169 Google Inc. 204 | AS15169 Google Inc. 205 | AS15169 Google Inc. 206 | AS15169 Google Inc. 207 | AS15169 Google Inc. 208 | .LINK 209 | http://sushihangover.blogspot.com 210 | .LINK 211 | https://github.com/sushihangover 212 | #> 213 | Param ( 214 | [Parameter(Mandatory=$true,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true)][String]$IPAddress 215 | ) 216 | Begin { 217 | if (!(Test-AssemblyLoaded -AssemblyName SushiHangover.GeoIP.LookupService)) { 218 | Import-GeoIp 219 | } 220 | $CityIPDatabasePath = Join-Path -Path $PSScriptRoot -ChildPath 'MaxMindGeoIpDB\GeoIPASNum.dat’ 221 | $CityIPDatabase = ls $CityIPDatabasePath 222 | $geoip = New-Object SushiHangover.GeoIP.LookupService($CityIPDatabase.FullName, [SushiHangover.GeoIP.LookupService]::GEOIP_STANDARD) 223 | } 224 | Process { 225 | ($geoip.getOrg($IPAddress)) 226 | } 227 | End { 228 | } 229 | } 230 | Function Import-GeoIp { 231 | $CSFile = Join-Path -Path $PSScriptRoot -ChildPath 'Get-GeoIP.cs’ 232 | $SourceCode = [System.IO.File]::ReadAllText($CSFile) 233 | $Assemblies = ('System','System.IO','System.Net') 234 | try { 235 | Add-Type -TypeDefinition $SourceCode -ReferencedAssemblies $Assemblies -Language CSharp -IgnoreWarnings 236 | } catch { 237 | Write-Warning "An error occurred attempting to add the .NET Framework class to the PowerShell session." 238 | Write-Warning "The error was: $($Error[0].Exception.Message)" 239 | } 240 | } 241 | -------------------------------------------------------------------------------- /modules/SushiHangover-Tools/Install-WindowsUpdates.ps1: -------------------------------------------------------------------------------- 1 | Set-StrictMode –Version latest 2 | function Install-WindowsUpdates { 3 | <# 4 | .SYNOPSIS 5 | Get and optionally install Windows Updates 6 | .DESCRIPTION 7 | This script will get all available udpates for the computer it is run on. 8 | It will then optionally install those updates, provided they do not require 9 | user input. 10 | 11 | This script was based off the original vbs that appeared on the MSDN site. 12 | Please see the Related Links section for the URL. 13 | 14 | Without any parameters the script will return the title of each update that 15 | is currently available. 16 | 17 | The installation result codes from the Windows Update Agent (WUA COM Object) are: 18 | 19 | Exit Codes: 20 | 0 = scripting failure 21 | 1 = error obtaining or installing updates 22 | 2 = installation successful, no further updates to install 23 | 3 = reboot needed; rerun script after reboot 24 | 25 | .PARAMETER Install 26 | When present the script will download and install each update. If the EulaAccept 27 | param has not been passed, only updates that don't have a Eula will be applied. 28 | .PARAMETER EulaAccept 29 | When present will allow the script to download and install all updates that are 30 | currently available. 31 | .EXAMPLE 32 | C:\PS>Install-WindowsUpdates -ListOnly 33 | 34 | UninstallationNotes : 35 | Title : Definition Update for Windows Defender - KB2267602 (Definition 1.143.401.0) 36 | Description : Install this update to revise the definition files that are used to detect viruses, spyware, and 37 | other potentially unwanted software. Once you have installed this item, it cannot be removed. 38 | SupportUrl : http://go.microsoft.com/fwlink/?LinkId=52661 39 | RebootRequired : False 40 | .EXAMPLE 41 | C:\PS>Install-WindowsUpdates -WhatIf 42 | What if: Performing operation "Install-WindowsUpdates" on Target "Download 1 Windows Update Package(s)". 43 | .EXAMPLE 44 | C:\PS>Install-WindowsUpdates -Confirm 45 | 46 | Confirm 47 | Are you sure you want to perform this action? 48 | Performing operation "Install-WindowsUpdates" on Target "Download 1 Windows Update Package(s)". 49 | [Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): y 50 | 51 | Confirm 52 | Are you sure you want to perform this action? 53 | Performing operation "Install-WindowsUpdates" on Target "Install Definition Update for Windows Defender - KB2267602 54 | (Definition 1.143.401.0)". 55 | [Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): y 56 | .NOTES 57 | .LINK 58 | http://sushihangover.blogspot.com 59 | .LINK 60 | https://github.com/sushihangover 61 | .LINK 62 | http://msdn.microsoft.com/en-us/library/windows/desktop/aa387102(v=vs.85).aspx 63 | #> 64 | [cmdletbinding(SupportsShouldProcess=$True,ConfirmImpact="High")] 65 | Param ( 66 | [parameter(mandatory=$false)][switch]$RebootIfRequired, 67 | [parameter(mandatory=$false)][switch]$IncludeHidden, 68 | [parameter(mandatory=$false)][switch]$ListOnly 69 | ) 70 | Begin { 71 | $ScriptName = $MyInvocation.MyCommand.Name 72 | $Username = $env:USERDOMAIN + "\" + $env:USERNAME 73 | if (Test-IsElevatedUser) { 74 | New-EventLog -Source $ScriptName -LogName 'Windows Powershell' -ErrorAction SilentlyContinue 75 | 76 | $Message = "Script: " + $ScriptName + "`nScript User: " + $Username + "`nStarted: " + (Get-Date).toString() 77 | Write-EventLog -LogName 'Windows Powershell' -Source $ScriptName -EventID "104" -EntryType "Information" -Message $Message 78 | } 79 | $UpdateSession = New-Object -ComObject 'Microsoft.Update.Session' 80 | $UpdateSession.ClientApplicationID = 'Install Windows Updates via PowerShell' 81 | $ReBootRequired = $false 82 | } 83 | Process { 84 | $UpdateSearcher = $UpdateSession.CreateUpdateSearcher() 85 | $SearchQuery = "IsInstalled=0 and Type='Software'" 86 | if ($IncludeHidden.IsPresent) { 87 | $SearchQuery += ' and IsHidden=0' 88 | } 89 | try { 90 | $SearchResult = $UpdateSearcher.Search($SearchQuery) 91 | } catch [System.Management.Automation.MethodInvocationException] { # [Exception from HRESULT: 0x8024402C] { 92 | <# 93 | #> 94 | Write-Error $_.Exception.ToString() 95 | Write-Host "You can try the following to correct a HRESULT: 0x8024402C error and then retry this function" 96 | Write-Host " netsh winhttp reset proxy" 97 | Write-Host " net stop wuauserv" 98 | Write-Host " net start wuauserv" 99 | Write-Host " Microsoft KB900936 : http://support.microsoft.com/kb/900936" 100 | return 101 | } catch { 102 | Write-Error $_.Exception.ToString() 103 | return 104 | } 105 | if ($ListOnly.IsPresent) { 106 | ForEach ($Update in $SearchResult.Updates) { 107 | New-Object -TypeName PSObject -Property @{ 108 | Title = $Update.Title; Description = $Update.Description; SupportUrl = $Update.SupportUrl; 109 | UninstallationNotes = $Update.UninstallationNotes; RebootRequired = $Update.RebootRequired} 110 | } 111 | } elseif ($SearchResult.Updates.Count -ne 0) { 112 | if (Test-IsElevatedUser) { 113 | Write-Verbose 'Creating a collection of updates to download:' 114 | $UpdatesToDownload = New-Object -ComObject 'Microsoft.Update.UpdateColl' 115 | ForEach ($Update in $SearchResult.Updates) { 116 | $addThisUpdate = $false 117 | if ($Update.InstallationBehavior.CanRequestUserInput) { 118 | Write-Verbose "> Skipping: $($Update.Title) because it requires user input" 119 | } elseif ($Update.EulaAccepted -eq $false) { 120 | if ($pscmdlet.ShouldProcess($Update.Title + " has a license agreement that must be accepted:")) { 121 | $Update.AcceptEula() 122 | $addThisUpdate = $true 123 | } else { 124 | Write-Verbose "> Skipping: $($Update.Title) because the license agreement was declined" 125 | } 126 | } else { 127 | $addThisUpdate = $true 128 | } 129 | if ($addThisUpdate) { 130 | Write-Verbose "Adding: $($Update.Title) to download list" 131 | $UpdatesToDownload.Add($Update) |Out-Null 132 | } 133 | } 134 | if ($UpdatesToDownload.Count -ne 0) { 135 | $DLCount = $UpdatesToDownload.Count 136 | if ($pscmdlet.ShouldProcess("Download $DLCount Windows Update Package(s)")) { 137 | Write-Verbose 'Downloading updates...' 138 | $Downloader = $UpdateSession.CreateUpdateDownloader() 139 | $Downloader.Updates = $UpdatesToDownload 140 | $Downloader.Download() | Out-Null 141 | } 142 | } 143 | $UpdatesToInstall = New-Object -ComObject 'Microsoft.Update.UpdateColl' 144 | $rebootMayBeRequired = $false 145 | $Installer = $UpdateSession.CreateUpdateInstaller() 146 | foreach ($Update in $SearchResult.Updates) { 147 | $UpdateTitle = $Update.Title 148 | if ($Update.IsDownloaded) { 149 | Write-Verbose "Successfully downloaded & ready to install : ($UpdateTitle)" 150 | $UpdatesToInstall.Add($Update) |Out-Null 151 | if ($Update.InstallationBehavior.RebootBehavior -gt 0) { 152 | $rebootMayBeRequired = $true 153 | } 154 | $Installer.Updates = $UpdatesToInstall 155 | if ($pscmdlet.ShouldProcess("Install $UpdateTitle")) { 156 | Write-Verbose "Installing $UpdateTitle" 157 | $InstallationResult = $Installer.Install() 158 | if ($InstallationResult.RebootRequired) { 159 | $ReBootRequired = $true 160 | } 161 | Write-Verbose "Installation Result: $($InstallationResult.ResultCode)" 162 | Write-Verbose "Reboot Required: $($InstallationResult.RebootRequired)" 163 | Write-Verbose 'Listing of updates installed and individual installation results' 164 | for($i=0; $i -lt $UpdatesToInstall.Count; $i++) { 165 | New-Object -TypeName PSObject -Property @{ 166 | Title = $UpdateTitle; Result = $InstallationResult.ResultCode} 167 | } 168 | } 169 | $UpdatesToInstall.Clear() 170 | } 171 | } 172 | } else { 173 | throw "Elevated user required for installation" 174 | } 175 | } else { 176 | Write-Verbose "No updates are available" 177 | } 178 | } 179 | End { 180 | $Message = "Script: " + $ScriptName + "`nScript User: " + $Username + "`nFinished: " + (Get-Date).toString() 181 | Write-EventLog -LogName 'Windows Powershell' -Source $ScriptName -EventID "104" -EntryType "Information" -Message $Message 182 | if ($ReBootRequired -and $RebootIfRequired.IsPresent) { 183 | Restart-Computer -Force 184 | } 185 | } 186 | } -------------------------------------------------------------------------------- /modules/IsePack/En-US/about_ISEPack_Module.help.txt: -------------------------------------------------------------------------------- 1 | TOPIC 2 | about_ISEPack_Module 3 | 4 | SHORT DESCRIPTION 5 | Describes the ISEPack module in the Windows 7 Resource Kit. 6 | 7 | LONG DESCRIPTION 8 | The ISEPack module adds menu items to the Windows PowerShell Integrated Scripting 9 | Environment (ISE). This module has no effect on the Windows PowerShell console or 10 | other host programs. 11 | 12 | To use the module, start Windows PowerShell ISE and then use the Import-Module 13 | cmdlet to add the module to your session. The command is: 14 | 15 | import-module isepack 16 | 17 | To use the module in every Windows PowerShell ISE session, add the 18 | "Import-Module ISEPack" command to a Windows PowerShell ISE profile. For more 19 | information, see "How to Use Profiles in Windows PowerShell ISE" 20 | (http://technet.microsoft.com/en-us/library/dd819434.aspx). 21 | 22 | The ISEPack module also adds to your session the functions that make the commands 23 | work. You can use these functions in your session and you can examine the function 24 | code to learn how to customize Windows PowerShell ISE. To find these functions, after 25 | importing the ISEPaCK module, type: 26 | 27 | get-command -module isepack 28 | 29 | 30 | MENU ITEMS 31 | The ISEPack module adds the following menu items to Windows PowerShell ISE. 32 | 33 | 34 | ISEPack Menu: Click Add-Ons, ISEPack 35 | 36 | Export-FormatView (CTRL+ALT+F) 37 | Creates a view definition for a type that includes only the properties that 38 | you specify and exports the definition. Use this command to create a view 39 | definition for a Windows PowerShell Format.ps1xml file. For more information, 40 | see about_Format_ps1xml. 41 | 42 | Invoke-Line (F6) 43 | Executes a line of code from a script. To use this command, place the cursor 44 | on any line in the Script pane and then use Invoke-Line. 45 | 46 | Show-HelpForCurrentSelection (CTRL+ALT+H) 47 | Displays the full version of help at the command line for text that is 48 | selected in any pane. Unlike F1, this command does not open the Windows 49 | PowerShell Help compiled help file. 50 | 51 | Show-Member (ALT+M) 52 | Displays the properties and methods of the selected objects in an interactive 53 | grid view window. To use this command, select a variable, command, or script 54 | block that defines an object, such as "get-process powershell_ise", in any 55 | pane, and then use Show-Member. 56 | 57 | Show-SyntaxForCurrentCommand (ALT+Y) 58 | Displays the syntax diagram for the selected commands. To use this command, 59 | select cmdlet, alias, or function names in any pane, and then use 60 | Show-SyntaxForCurrentCommand. 61 | 62 | Show-TypeConstructorForCurrentType (ALT+C) 63 | Gets the type constructor for the selected type. To use this command, 64 | select a type in any pane, such as [int], [string], or [wmi], and then use 65 | Show-TypeConstructorForCurrentType. 66 | 67 | 68 | Edit Menu: Click Add-Ons, ISEPack, Edit 69 | 70 | AutoSave (CTRL+F12) 71 | Saves the current script. If the script was not previously saved, 72 | it creates a file name based on the name of the first function 73 | in the script and saves it in the current directory. 74 | 75 | ClearOutput (F12) 76 | Deletes all content from the output pane. Same as CLS and the 77 | "Clear Output Pane" tool. 78 | 79 | ConvertTo-Function (ALT+SHIFT+F) 80 | Converts the current script into a function and displays it in 81 | a new file. The name of the function is the name of the script 82 | (without the .ps1 file name extension). 83 | 84 | Copy-Colored (CTRL+SHIFT+C) 85 | Copies text and its color from the Script pane. You can select text and 86 | then copy. By default, it copies all text in the Script pane. This function 87 | lets you paste the syntax-colored script into other programs, such as Microsoft 88 | Word. 89 | 90 | Copy-ColoredAsHtml (CTRL+ALT+SHIFT+C) 91 | Copies text and its color from the Script pane and converts it to HTML 92 | format. You can select text and then copy. By default, it copies all text 93 | in the Script pane. This function lets you paste the syntax-colored script 94 | into an HTML document. 95 | 96 | Copy-FilePathToClipboard (CTRL+P) 97 | Copies the full path and file name of the current script. If the script 98 | has not yet been saved, it uses the default name (Untitled*) and the 99 | current directory. 100 | 101 | Move-ToNextGroup (ALT+SHIFT+RIGHT) 102 | Moves your cursor to the next code group in the script. This command helps 103 | you to move between logical sections of a script that you are viewing or 104 | editng. 105 | 106 | Move-ToLastGroup (ALT+SHIFT+LEFT) 107 | Moves the cursor to the last code group in the script. This command helps 108 | you to move between logical sections of a script that you are viewing or 109 | editng. 110 | 111 | Move-ToLastGroup (ALT+SHIFT+LEFT) 112 | Moves the cursor to the last code group in the script. This command helps 113 | you to move between logical sections of a script that you are viewing or 114 | editng. 115 | 116 | Profile (CTRL+E) 117 | Opens the CurrentUser\CurrentHost profile in the Script pane. 118 | 119 | Split-CurrentFile (CTRL+ALT+MINUS) 120 | Splits a script with many functions into a many scripts with one function 121 | each. This command copies each function in the script to a separate file. 122 | The original script is not changed. 123 | 124 | Toggle Comments (CTRL+ALT+C) 125 | Adds the comment symbok to uncommented lines and deletes the comment symbol (#) 126 | from commented lines . To use this command, select lines of code in the current 127 | script and use "Toggle Comments". 128 | 129 | 130 | 131 | Modules Menu: Click Add-Ons, ISEPack, Modules 132 | 133 | Import-CurrentModule (CTRL+ALT+M) 134 | Imports the module that contains the current script or function. This 135 | command works when the code in the current script includes a function that 136 | comes from a module. The function must have been run at least once before 137 | using the command. 138 | 139 | New-ScriptModuleFromCurrentLocation 140 | Creates a script module (.psm1) that includes the current script and all 141 | .ps1 files that are in the same directory as the script. The module is named 142 | for the directory. The command works only when the current script is saved in 143 | a .ps1 file and a .psm1 file with the directory name does not already exist in 144 | the directory. 145 | 146 | 147 | 148 | 149 | Navigation Menu: Click Add-Ons, ISEPack, Navigation 150 | 151 | Close-AllOpenedFiles (CTRL+SHIFT+F4) 152 | Closes all files in the Script pane, except for those that have been changed 153 | and not saved. 154 | 155 | Move-ToNextPowerShellTab (CTRL+ALT+SHIFT+RIGHT) 156 | Displays the PowerShell tab to the right of the current tab. Because each 157 | PowerShell tab has its own session, this command works only in PowerShell 158 | tabs in which the ISEPack module has been imported. To enable this command in 159 | all PowerShell tabs, add the Import-Module command to your Windows PowerShell 160 | profile. 161 | 162 | Move-ToLastPowerShellTab (CTRL+ALT+SHIFT+LEFT) 163 | Displays the right-most PowerShell tab. 164 | 165 | Push-CurrentFileLocation 166 | Saves the current directory location and changes to the directory that 167 | contains the current script. To return to the original location, use the 168 | Pop-Location cmdlet ("popd"). 169 | 170 | Rename-CurrentPowerShellTab (CTRL+ALT+N) 171 | Prompts you for a new name for the current PowerShell tab. 172 | 173 | Show-ExplorerForCurrentFile (CTRL+ALT+E) 174 | Opens Windows Explorer to the directory that contains the current script. 175 | 176 | 177 | 178 | 179 | Snippets Menu: Click Add-Ons, ISEPack, Snippets 180 | 181 | Add-ForeachStatemnt (CTRL + SHIFT + F) 182 | Adds a ForEach statement to the current script. Use a Foreach statement to 183 | act on each item in a collection. 184 | 185 | Add-IfStatement (CTRL + SHIFT + I) 186 | Adds an If statement to the current script. Use an IF statement to 187 | perform an action only when specified conditions are met. 188 | 189 | Add-InlineHelp (ALT + H) 190 | Adds comment-based help to the current script. For information about the 191 | placement of comment-based help, see about_comment-based_help. 192 | 193 | Add-Parameter (ALT + P) 194 | Adds a Parameter statement to the current script. For information about 195 | parameter attributes and arguments, see about_functions_advanced_parameters. 196 | 197 | Add-Pinvoke (CTRL + Period) 198 | Adds a P/Invoke statement to the current script. Use a P/Invoke statement to call 199 | functions that are written in C or C++. 200 | 201 | Add-SwitchStatement (CTRL + SHIFT + S) 202 | Adds a Switch statement to the current script. Use a Switch statement to 203 | perform different actions for each value of a property or variable. 204 | 205 | 206 | NOTES 207 | The ISEPack Module uses the Windows PowerShell ISE Object Model and the $psise host 208 | variable. 209 | 210 | 211 | SEE ALSO 212 | about_Modules 213 | Get-Module 214 | Import-Module 215 | Remove-Module 216 | 217 | "The Windows PowerShell ISE Scripting Object Model": http://technet.microsoft.com/en-us/library/dd819478.aspx 218 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | 2 | Apache License 3 | Version 2.0, January 2004 4 | http://www.apache.org/licenses/ 5 | 6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 7 | 8 | 1. Definitions. 9 | 10 | "License" shall mean the terms and conditions for use, reproduction, 11 | and distribution as defined by Sections 1 through 9 of this document. 12 | 13 | "Licensor" shall mean the copyright owner or entity authorized by 14 | the copyright owner that is granting the License. 15 | 16 | "Legal Entity" shall mean the union of the acting entity and all 17 | other entities that control, are controlled by, or are under common 18 | control with that entity. For the purposes of this definition, 19 | "control" means (i) the power, direct or indirect, to cause the 20 | direction or management of such entity, whether by contract or 21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 22 | outstanding shares, or (iii) beneficial ownership of such entity. 23 | 24 | "You" (or "Your") shall mean an individual or Legal Entity 25 | exercising permissions granted by this License. 26 | 27 | "Source" form shall mean the preferred form for making modifications, 28 | including but not limited to software source code, documentation 29 | source, and configuration files. 30 | 31 | "Object" form shall mean any form resulting from mechanical 32 | transformation or translation of a Source form, including but 33 | not limited to compiled object code, generated documentation, 34 | and conversions to other media types. 35 | 36 | "Work" shall mean the work of authorship, whether in Source or 37 | Object form, made available under the License, as indicated by a 38 | copyright notice that is included in or attached to the work 39 | (an example is provided in the Appendix below). 40 | 41 | "Derivative Works" shall mean any work, whether in Source or Object 42 | form, that is based on (or derived from) the Work and for which the 43 | editorial revisions, annotations, elaborations, or other modifications 44 | represent, as a whole, an original work of authorship. For the purposes 45 | of this License, Derivative Works shall not include works that remain 46 | separable from, or merely link (or bind by name) to the interfaces of, 47 | the Work and Derivative Works thereof. 48 | 49 | "Contribution" shall mean any work of authorship, including 50 | the original version of the Work and any modifications or additions 51 | to that Work or Derivative Works thereof, that is intentionally 52 | submitted to Licensor for inclusion in the Work by the copyright owner 53 | or by an individual or Legal Entity authorized to submit on behalf of 54 | the copyright owner. For the purposes of this definition, "submitted" 55 | means any form of electronic, verbal, or written communication sent 56 | to the Licensor or its representatives, including but not limited to 57 | communication on electronic mailing lists, source code control systems, 58 | and issue tracking systems that are managed by, or on behalf of, the 59 | Licensor for the purpose of discussing and improving the Work, but 60 | excluding communication that is conspicuously marked or otherwise 61 | designated in writing by the copyright owner as "Not a Contribution." 62 | 63 | "Contributor" shall mean Licensor and any individual or Legal Entity 64 | on behalf of whom a Contribution has been received by Licensor and 65 | subsequently incorporated within the Work. 66 | 67 | 2. Grant of Copyright License. Subject to the terms and conditions of 68 | this License, each Contributor hereby grants to You a perpetual, 69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 70 | copyright license to reproduce, prepare Derivative Works of, 71 | publicly display, publicly perform, sublicense, and distribute the 72 | Work and such Derivative Works in Source or Object form. 73 | 74 | 3. Grant of Patent License. Subject to the terms and conditions of 75 | this License, each Contributor hereby grants to You a perpetual, 76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 77 | (except as stated in this section) patent license to make, have made, 78 | use, offer to sell, sell, import, and otherwise transfer the Work, 79 | where such license applies only to those patent claims licensable 80 | by such Contributor that are necessarily infringed by their 81 | Contribution(s) alone or by combination of their Contribution(s) 82 | with the Work to which such Contribution(s) was submitted. If You 83 | institute patent litigation against any entity (including a 84 | cross-claim or counterclaim in a lawsuit) alleging that the Work 85 | or a Contribution incorporated within the Work constitutes direct 86 | or contributory patent infringement, then any patent licenses 87 | granted to You under this License for that Work shall terminate 88 | as of the date such litigation is filed. 89 | 90 | 4. Redistribution. You may reproduce and distribute copies of the 91 | Work or Derivative Works thereof in any medium, with or without 92 | modifications, and in Source or Object form, provided that You 93 | meet the following conditions: 94 | 95 | (a) You must give any other recipients of the Work or 96 | Derivative Works a copy of this License; and 97 | 98 | (b) You must cause any modified files to carry prominent notices 99 | stating that You changed the files; and 100 | 101 | (c) You must retain, in the Source form of any Derivative Works 102 | that You distribute, all copyright, patent, trademark, and 103 | attribution notices from the Source form of the Work, 104 | excluding those notices that do not pertain to any part of 105 | the Derivative Works; and 106 | 107 | (d) If the Work includes a "NOTICE" text file as part of its 108 | distribution, then any Derivative Works that You distribute must 109 | include a readable copy of the attribution notices contained 110 | within such NOTICE file, excluding those notices that do not 111 | pertain to any part of the Derivative Works, in at least one 112 | of the following places: within a NOTICE text file distributed 113 | as part of the Derivative Works; within the Source form or 114 | documentation, if provided along with the Derivative Works; or, 115 | within a display generated by the Derivative Works, if and 116 | wherever such third-party notices normally appear. The contents 117 | of the NOTICE file are for informational purposes only and 118 | do not modify the License. You may add Your own attribution 119 | notices within Derivative Works that You distribute, alongside 120 | or as an addendum to the NOTICE text from the Work, provided 121 | that such additional attribution notices cannot be construed 122 | as modifying the License. 123 | 124 | You may add Your own copyright statement to Your modifications and 125 | may provide additional or different license terms and conditions 126 | for use, reproduction, or distribution of Your modifications, or 127 | for any such Derivative Works as a whole, provided Your use, 128 | reproduction, and distribution of the Work otherwise complies with 129 | the conditions stated in this License. 130 | 131 | 5. Submission of Contributions. Unless You explicitly state otherwise, 132 | any Contribution intentionally submitted for inclusion in the Work 133 | by You to the Licensor shall be under the terms and conditions of 134 | this License, without any additional terms or conditions. 135 | Notwithstanding the above, nothing herein shall supersede or modify 136 | the terms of any separate license agreement you may have executed 137 | with Licensor regarding such Contributions. 138 | 139 | 6. Trademarks. This License does not grant permission to use the trade 140 | names, trademarks, service marks, or product names of the Licensor, 141 | except as required for reasonable and customary use in describing the 142 | origin of the Work and reproducing the content of the NOTICE file. 143 | 144 | 7. Disclaimer of Warranty. Unless required by applicable law or 145 | agreed to in writing, Licensor provides the Work (and each 146 | Contributor provides its Contributions) on an "AS IS" BASIS, 147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 148 | implied, including, without limitation, any warranties or conditions 149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 150 | PARTICULAR PURPOSE. You are solely responsible for determining the 151 | appropriateness of using or redistributing the Work and assume any 152 | risks associated with Your exercise of permissions under this License. 153 | 154 | 8. Limitation of Liability. In no event and under no legal theory, 155 | whether in tort (including negligence), contract, or otherwise, 156 | unless required by applicable law (such as deliberate and grossly 157 | negligent acts) or agreed to in writing, shall any Contributor be 158 | liable to You for damages, including any direct, indirect, special, 159 | incidental, or consequential damages of any character arising as a 160 | result of this License or out of the use or inability to use the 161 | Work (including but not limited to damages for loss of goodwill, 162 | work stoppage, computer failure or malfunction, or any and all 163 | other commercial damages or losses), even if such Contributor 164 | has been advised of the possibility of such damages. 165 | 166 | 9. Accepting Warranty or Additional Liability. While redistributing 167 | the Work or Derivative Works thereof, You may choose to offer, 168 | and charge a fee for, acceptance of support, warranty, indemnity, 169 | or other liability obligations and/or rights consistent with this 170 | License. However, in accepting such obligations, You may act only 171 | on Your own behalf and on Your sole responsibility, not on behalf 172 | of any other Contributor, and only if You agree to indemnify, 173 | defend, and hold each Contributor harmless for any liability 174 | incurred by, or claims asserted against, such Contributor by reason 175 | of your accepting any such warranty or additional liability. 176 | 177 | END OF TERMS AND CONDITIONS 178 | 179 | APPENDIX: How to apply the Apache License to your work. 180 | 181 | To apply the Apache License to your work, attach the following 182 | boilerplate notice, with the fields enclosed by brackets "[]" 183 | replaced with your own identifying information. (Don't include 184 | the brackets!) The text should be enclosed in the appropriate 185 | comment syntax for the file format. We also recommend that a 186 | file or class name and description of purpose be included on the 187 | same "printed page" as the copyright notice for easier 188 | identification within third-party archives. 189 | 190 | Copyright [yyyy] [name of copyright owner] 191 | 192 | Licensed under the Apache License, Version 2.0 (the "License"); 193 | you may not use this file except in compliance with the License. 194 | You may obtain a copy of the License at 195 | 196 | http://www.apache.org/licenses/LICENSE-2.0 197 | 198 | Unless required by applicable law or agreed to in writing, software 199 | distributed under the License is distributed on an "AS IS" BASIS, 200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 201 | See the License for the specific language governing permissions and 202 | limitations under the License. 203 | --------------------------------------------------------------------------------