Skip to content

Instantly share code, notes, and snippets.

@matejskubic
matejskubic / gist:7be604a7e1c16cdbf8b5
Created May 5, 2014 14:46
Powershell post form with relative / absolute url
$resp = Invoke-WebRequest -Verbose -Uri $url
$selectedForm = $resp.Forms[0]
$webAction = New-Object System.Uri ($resp.BaseResponse.ResponseUri, $selectedForm.Action)
$resp2 = Invoke-WebRequest -Verbose -Uri $webAction -Method $selectedForm.Method -Body $selectedForm
@matejskubic
matejskubic / LastWake.bat
Created June 3, 2014 20:49
What woke the system from the last sleep transition
powercfg -lastwake
@matejskubic
matejskubic / _AreaPageSimulation_.xpo
Created September 18, 2014 08:53
AX 2012 Area Page Form simulation
Exportfile for AOT version 1.0 or later
Formatversion: 1
***Element: FRM
; Microsoft Dynamics AX Forms unloaded
; --------------------------------------------------------------------------------
FRMVERSION 12
FORM #_AreaPageSimulation_
function Get-LatestDropLocation {
param(
[Parameter(Position=0,Mandatory=$true)] [string]$tfsLocation,
[Parameter(Position=1,Mandatory=$true)] [string]$projectName,
[Parameter(Position=3,Mandatory=$true)] [string]$buildDefinitionName
)
Add-Type -AssemblyName "Microsoft.TeamFoundation.Client, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"
Add-Type -AssemblyName "Microsoft.TeamFoundation.Build.Client, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"
$tfsUri = New-object Uri($tfsLocation)
@matejskubic
matejskubic / DeleteBackupHistory.sql
Created March 9, 2015 15:12
Delete backup history mssql server
set xact_abort on
declare @media_set_id int = 6089
use msdb
begin tran
delete from backupfile
where exists
(select null
from backupset
where backupset.backup_set_id = backupfile.backup_set_id
@matejskubic
matejskubic / gist:8a20bfb2c052f01c7b13
Created March 11, 2015 13:44
AX 2012 - DeleteFiscalCalendarYear
static void DeleteFiscalCalendarYear(Args _args)
{
FiscalCalendarYear fiscalCalendarYear;
FiscalCalendarPeriod fiscalCalendarPeriod;
LedgerFiscalCalendarPeriod ledgerFiscalCalendarPeriod;
LedgerPeriodModuleAccessControl ledgerPeriodModuleAccessControl;
FiscalYearName yearToDelete = '2011';
ttsBegin;
@matejskubic
matejskubic / IterationBoard
Created April 1, 2015 19:51
Add background color to requirements on the backlog taskboard
<!-- \Program Files\Microsoft Team Foundation Server 12.0\Application Tier\Web Services\_areas\Agile\Views\Backlogs\IterationBoard.aspx -->
<!-- add at the end of <asp:Content ContentPlaceHolderID="RightHubContent" runat="server"> -->
<script defer="defer" type="application/javascript">
function popraviOzadje()
{
try
{
var taskboardData = JSON.parse(document.getElementById('taskboard').children[0].innerHTML);
var parentIds = taskboardData.parentIds;
var stateCol = 0;
@matejskubic
matejskubic / runasNetOnly.bat
Created April 4, 2015 20:50
RunAs for network access only
runas /user:domain\user /netonly %1
@matejskubic
matejskubic / Get-UserGroups.ps1
Created June 10, 2015 11:12
Saves user group membership to csv
Import-Module ActiveDirectory
Get-ADPrincipalGroupMembership (Read-Host "Username")|select SamAccountName| sort SamAccountName | ConvertTo-Csv -NoTypeInformation > "$($env:TEMP)\user-groups.csv"
start "$($env:TEMP)\user-groups.csv"
@matejskubic
matejskubic / ShowAdUserGroups.bat
Created September 8, 2015 11:14
Window for AD user search and its properties
Rundll32 dsquery.dll OpenQueryWindow