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
| $connectionString = "Data Source=localhost;Initial Catalog=SomeDatabase;Integrated Security=True" | |
| $config = "path\to\app.config" | |
| $xml = (Get-Content $config) -as [xml] | |
| $xml.SelectSingleNode('/configuration/connectionStrings/add[@name="ConnectionString.Key"]/@connectionString').set_InnerXML($connectionString) | |
| $xml.Save($config) |
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
| <# | |
| .Synopsis | |
| Installs a Windows service on a remote computer. | |
| Sets the credentials for the service to run under. | |
| Grants SeServiceLogonRight to the account. | |
| Sets service recovery options. | |
| .Parameter computerName | |
| Defines the name of the computer which will host the service. | |
| Default is the local computer on which the script is run. | |
| .Parameter name |
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
| <# | |
| .Synopsis | |
| Get the last release. | |
| .Example | |
| .\github-last-release.ps1 -username GITHUB_USERNAME -token OAUTH_TOKEN -repo GITHUB_REPOSITORY -release_tag_name v1.0.0 -asset_name "C:\temp\MyRelease.zip" -asset_label "Zip archive" | |
| #> | |
| param ( | |
| [string] $api_base = "https://api.github.com", | |
| [Parameter (Mandatory = $true)] |
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
| <# | |
| .Synopsis | |
| Robocopy wrapper with standard 0 (success) and 1 (failure) exit codes. | |
| .Parameter source | |
| Defines the source folder | |
| .Parameter target | |
| Defines the target folder | |
| .Parameter include | |
| Defines the files to include. Accepts wildcards. Eg: -include *.dll,*.pdb | |
| Optional, Default value is $null and will include all files from source. |
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
| param( | |
| [string] $snk | |
| ) | |
| $noSDK = $true | |
| foreach ($folder in @("Program Files", "Program Files (x86)")){ | |
| $sns = (Get-ChildItem -Path ("{0}\{1}\Microsoft SDKs\Windows" -f $env:SystemDrive, $folder) -Filter "sn.exe" -Recurse | Select-Object FullName) | |
| foreach ($sn in $sns){ | |
| #$token = (& $sn.FullName -tp $snk | Select-String "^Public key token is " | % {$_.Line.Split(" ")[4]}) | |
| #& $sn.FullName -Vr *,$token | |
| & $sn.FullName -Vr * |
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
| param( | |
| [string] $assemblyInfoFile, | |
| [hashtable] $parameters | |
| ) | |
| Write-Host ("`$assemblyInfoFile: {0}" -f $assemblyInfoFile) | |
| foreach($key in $($parameters.Keys)){ | |
| if($parameters[$key] -ne $null){ | |
| $assemblyInfo = Get-Content $assemblyInfoFile | |
| $pattern = ('^\[assembly: {0}\("(.*)"\)\]' -f $key) | |
| $oldValue = ($assemblyInfo | Select-String -Pattern $pattern | % { $_.Matches } ).Groups[1].Value |
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
| param( | |
| [string] $archive, | |
| [string] $binding = "*:80:" | |
| ) | |
| $xml = [xml] (Get-Content $archive) | |
| if ($xml.SelectSingleNode("//bindings/binding") -and !$xml.SelectSingleNode("//bindings/binding[@bindingInformation='$binding']")) { | |
| $xml.SelectSingleNode("//bindings").AppendChild($xml.SelectSingleNode("//bindings/binding").Clone()) | |
| $xml.SelectSingleNode("//bindings/binding/@bindingInformation").set_InnerXML($binding) | |
| $xml.Save($archive) | |
| } |
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
| param ( | |
| [hashtable] $pokes, | |
| [string] $config | |
| ) | |
| $xml = (Get-Content $config) -as [xml] | |
| foreach($xpath in $($pokes.Keys)){ | |
| $xml.SelectSingleNode($xpath).set_InnerXML($pokes[$xpath]) | |
| } | |
| $xml.Save($config) |
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
| :: set these variables to match TeamCity environment | |
| SET TEAMCITY_DATA_PATH=D:\Config\TeamCity | |
| SET TEAMCITY_DATA_BACKUP=D:\Temp\TeamCity | |
| SET TEAMCITY_HOME=C:\TeamCity | |
| SET TEAMCITY_BACKUP_FILE=TeamCity_Backup_xxx_xxx.zip | |
| :: maintainDB expects these directories to be empty or absent. | |
| move /Y %%TEAMCITY_DATA_PATH%%\config %%TEAMCITY_DATA_BACKUP%%\config | |
| move /Y %%TEAMCITY_DATA_PATH%%\system %%TEAMCITY_DATA_BACKUP%%\system |
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 @PackageRegistrationKey int | |
| SELECT @PackageRegistrationKey = [Key] | |
| FROM PackageRegistrations | |
| WHERE Id = 'MyNastyPackage' | |
| BEGIN TRANSACTION | |
| DELETE pf | |
| FROM [NuGetGallery].[dbo].[PackageFrameworks] pf | |
| JOIN Packages p ON pf.Package_Key = p.[Key] | |
| WHERE PackageRegistrationKey = @PackageRegistrationKey |