This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # ========================================================================== | |
| # | |
| # Script Name: Install-Programs.ps1 | |
| # | |
| # Author: Andy Parkhill | |
| # | |
| # Date Created: 27/03/2014 | |
| # | |
| # Description: A simple environment setup script for my personal laptop. | |
| # |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| DECLARE @DeleteProcCommand NVARCHAR(500) | |
| DECLARE Syntax_Cursor CURSOR | |
| FOR | |
| SELECT 'DROP PROCEDURE ' + p.NAME | |
| FROM sys.procedures p | |
| OPEN Syntax_Cursor | |
| FETCH NEXT FROM Syntax_Cursor |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Get-ChildItem 'C:\Temp\' -recurse -filter "*.dll" -name | % { [IO.Path]::GetFileNameWithoutExtension($_) } | Sort-Object -unique |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [System.Data.Sql.SqlDataSourceEnumerator]::Instance.GetDataSources() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| If (-NOT ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) | |
| { | |
| #"No Administrative rights, it will display a popup window asking user for Admin rights" | |
| $arguments = "& '" + $myinvocation.mycommand.definition + "'" | |
| Start-Process "$psHome\powershell.exe" -Verb runAs -ArgumentList $arguments | |
| break | |
| } | |
| #"After user clicked Yes on the popup, your file will be reopened with Admin rights" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function md5hash($path) | |
| { | |
| $fullPath = Resolve-Path $path | |
| $md5 = new-object -TypeName System.Security.Cryptography.MD5CryptoServiceProvider | |
| $file = [System.IO.File]::Open($fullPath,[System.IO.Filemode]::Open, [System.IO.FileAccess]::Read) | |
| [System.BitConverter]::ToString($md5.ComputeHash($file)) | |
| $file.Dispose() | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Get-WmiObject Win32_Product | Sort-Object Vendor, Name | Format-Table Vendor, Name, Version -groupBy Vendor | Out-File C:\Temp\Test.txt | |
| # Note, can also use | |
| # Get-ItemProperty HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\* | Sort-Object Publisher, DisplayName | Format-Table DisplayName, Publisher, InstallDate | Out-File C:\Temp\Installed.txt | |
| # See | |
| # http://blogs.technet.com/b/heyscriptingguy/archive/2011/11/13/use-powershell-to-quickly-find-installed-software.aspx | |
| # and | |
| # http://blogs.technet.com/b/heyscriptingguy/archive/2013/11/15/use-powershell-to-find-installed-software.aspx | |
| # for details |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Get-ChildItem "C:\Temp\IIS Logs" -recurse | where {$_.extension -eq ".log"} | % { Write-Host $_.FullName } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Taken from http://stackoverflow.com/a/6882750 | |
| Update-Package -reinstall -Project YourProjectName |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| REM To run in the %windir%\system32\inetsrv\ folder | |
| appcmd list wp |
OlderNewer