This file contains 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
## Invoke a Win32 P/Invoke call. | |
function Invoke-Win32([string] $dllName, [Type] $returnType, | |
[string] $methodName, [Type[]] $parameterTypes, [Object[]] $parameters) | |
{ | |
## Begin to build the dynamic assembly | |
$domain = [AppDomain]::CurrentDomain | |
$name = New-Object Reflection.AssemblyName �PInvokeAssembly� | |
$assembly = $domain.DefineDynamicAssembly($name, �Run�) | |
$module = $assembly.DefineDynamicModule(�PInvokeModule�) | |
$type = $module.DefineType(�PInvokeType�, �Public,BeforeFieldInit�) |
This file contains 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
git tfs -d clone http://myServer:8080/tfs/myProject '$/Donor/Online Registration/Main' . --branches=auto | |
Looking for changeset 22351 in git repository... | |
=> Commit not found! | |
Looking for root changeset for branch:$/Donor/Online Registration/Dev/Dev1 | |
Looking to find branch '$/Donor/Online Registration/Dev/Dev1' in all TFS branches... | |
Looking for all branches... | |
Found parent branch : $/Donor/Online Registration/Main | |
Cleaning... | |
Sep.Git.Tfs.Core.GitTfsException: error: a problem occurred when trying to clone the repository. Try to solve the proble |
This file contains 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
[Reflection.Assembly]::LoadFrom('C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\qyqpnmw4.vsi\Microsoft.TeamFoundation.Client.dll') | |
[Reflection.Assembly]::LoadFrom('C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\qyqpnmw4.vsi\Microsoft.TeamFoundation.VersionControl.Client.dll') | |
[Reflection.Assembly]::LoadFrom('C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\qyqpnmw4.vsi\Microsoft.TeamFoundation.WorkItemtracking.Client.dll') | |
[Reflection.Assembly]::LoadFrom('C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\qyqpnmw4.vsi\Microsoft.TeamFoundation.WorkItemtracking.Proxy.dll') | |
$m_srv = [Microsoft.TeamFoundation.Client.TfsTeamProjectCollectionFactory]::GetTeamProjectCollection('https://btmtestmigration.visualstudio.com'); | |
$m_srv.EnsureAuthenticated() | |
$WIStore = $m_srv.GetService([Microsoft.TeamFoundation.WorkItemTracking.Proxy.WorkItemServer]) | |
$WIStore.GetWorkItemLinkChanges([Guid]::NewGuid() |
This file contains 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
<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><QueryBranchObjectsResponse xmlns="http://schemas.microsoft.com/TeamFoundation/2005/06/VersionControl/ClientServices/03"><QueryBranchObjectsResult><BranchObject><Properties><RootItem it="$/SystemCenter/Main" ctype="8"><Version xsi:type="ChangesetVersionSpec" cs="7861" /></RootItem><Description>Converted to Branch after Code given by Adam</Description><Owner>adam@driscoll.com</Owner><OwnerDisplayName>Adam Driscoll</OwnerDisplayName><OwnerUniqueName>adam@driscoll.com</OwnerUniqueName><BranchMappings /></Properties><DateCreated>2014-12-17T15:48:34.037Z</DateCreated><ChildBranches /><RelatedBranches /></BranchObject></QueryBranchObjectsResult></QueryBranchObjectsResponse></soap:Body></soap:Envelope> |
This file contains 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
#Backing methods | |
[System.Collections.ArrayList].GetMethods() | Where Name -like 'get_*' | Select Name | |
[System.Collections.ArrayList].GetMethods() | Where Name -like 'set_*' | Select Name | |
$ArrayList = New-Object System.Collections.ArrayList | |
$ArrayList.Add(1) | Out-Null | |
$ArrayList.Add(2) | Out-Null | |
#Indexer (parameterized property) | |
$ArrayList[1] |
This file contains 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
#This uses git-tfs and the PowerShell VSTS module | |
function ConvertTo-GitRepository { | |
param($Name, $Folder, $VstsUser, $VstsToken, $VstsAccountName, $VstsProjectName) | |
git tfs clone https://$VstsAccountName.visualstudio.com/defaultcollection $/$VstsProjectName/$Folder --branches=none | |
Push-Location (Split-Path $Folder -Leaf) | |
$ProjectId = Get-VstsProject -AccountName $VstsAccountName -User $VstsUser -Token $VstsToken | Where Name -eq $VstsProjectName | Select -Expand Id |
This file contains 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
$Ast = { | |
Set-Alias -Name Test -Value SomeValue | |
New-Alias -Name SomeOtherAlias -Value SomeValue | |
}.Ast | |
$SetAliasCommands = $Ast.FindAll({$args[0] -is [System.Management.Automation.Language.CommandAst] -and ($Command.CommandElements[0].Value -eq 'Set-Alias' -or $Command.CommandElements[0].Value -eq 'New-Alias')}, $true) | |
foreach($SetAliasCommand in $SetAliasCommands) | |
{ | |
$NextElementIsNameValue = $false |
This file contains 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 New-Detour | |
{ | |
param( | |
$Library, | |
$FunctionName, | |
[ScriptBlock]$Detour, | |
[String[]]$ReferencedAssemblies | |
) | |
#Download from easyhook.codeplex.com |
This file contains 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
static Repository() | |
{ | |
BsonClassMap.RegisterClassMap<Model>(cm => { | |
cm.AutoMap(); | |
cm.SetIdMember(cm.GetMemberMap(c => c.Id)); | |
cm.IdMemberMap.SetIdGenerator(CombGuidGenerator.Instance); | |
}); | |
} |
This file contains 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
public void SetSystemDate(Domain domain, DateTime dateTime) | |
{ | |
var connectionOptions = new ConnectionOptions(); | |
connectionOptions.Username = domain.UserName; | |
connectionOptions.Password = domain.Password; | |
connectionOptions.EnablePrivileges = true; | |
connectionOptions.Authentication = AuthenticationLevel.PacketPrivacy; | |
connectionOptions.Impersonation = ImpersonationLevel.Impersonate; | |
var offset = TimeZoneInfo.Local.GetUtcOffset(dateTime); | |
var minuteOffset = $"{Math.Round(offset.TotalMinutes):000}"; |