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 Dictionary | |
| { | |
| param([Type[]]$Type, [Hashtable]$Hashtable) | |
| $KeyType = $Type[0] | |
| $ValueType = $Type[1] | |
| $Dictionary = New-Object -TypeName "System.Collections.Generic.Dictionary[$KeyType,$ValueType]" | |
| $Hashtable.GetEnumerator() | % { |
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
| // Programmically get a list of the changes preventing model validation. | |
| // You'll likely see this error: | |
| //Unable to update database to match the current model because there are pending changes and automatic migration is disabled. | |
| //Either write the pending model changes to a code-based migration or enable automatic migration. | |
| //Set DbMigrationsConfiguration.AutomaticMigrationsEnabled to true to enable automatic migration. | |
| //This is how you can programmatically find out exactly what is preventing the validation | |
| var migrator = new DbMigrator(new vWorkspaceMigrationConfig { TargetDatabase = new DbConnectionInfo("connectionString", "System.Data.SqlClient") }); | |
| try | |
| { |
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
| $Proxy = New-WebServiceProxy -Uri "https://dev.service-now.com/change_task.do?WSDL" -Credential $Credential | |
| # | |
| # Is there a better way to determine the auto-gen'd WSDL argument type names? | |
| # | |
| $ClassName = $Proxy.getRecords.OverloadDefinitions[0].Split('(')[1].Split(' ')[0] | |
| $queryParams = new-object $ClassName | |
| $queryParams.__encoded_query = $query | |
| $Proxy.getRecords($queryParams) |
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
| New-PSDrive -Name "SiteName" -Root "SiteServerName" -PSProvider CMSite |
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
| Unregister-ScheduledJob "Check Sunrise and Sunset" -Force | |
| $MidnightTrigger = New-JobTrigger -Daily -At ([DateTime]::Today) | |
| Register-ScheduledJob -ScriptBlock { | |
| $astronomy = Invoke-RestMethod "http://api.wunderground.com/api/$key/astronomy/q/WI/Madison.json" | |
| $sunRiseHour = $astronomy.sun_phase.sunrise.hour | |
| $sunRiseMinute = $astronomy.sun_phase.sunrise.minute | |
| $sunriseTrigger = New-JobTrigger -Once -At ([DateTime]::Today).AddHours($sunRiseHour).AddMinutes($sunRiseMinute) |
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
| public void Authenticate() | |
| { | |
| SubscriptionCloudCredentials cred; | |
| var cert = new X509Certificate2(Convert.FromBase64String(AzureSettings.ManagementCertificate)); | |
| cred = new CertificateCloudCredentials(AzureSettings.Id, cert); | |
| var automationManagementClient = new AutomationManagementClient(cred); | |
| var content = automationManagementClient.Runbooks.Content("<resource group>", "<automation account>", "<runbook>"); | |
| } | |
| /* Returns the following exception |
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 Add-RandomScsmBulkData { | |
| [CmdletBinding()] | |
| param( | |
| [String[]]$Classes, | |
| [String[]]$Relationships, | |
| [int]$DataSetSize = 200) | |
| $itemCount = 0 | |
| $totalItems = ($classes.Length * $DataSetSize) + ($Relationships.Length * $DataSetSize) | |
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
| $Global:SMDefaultComputer = "ADSCSM3" | |
| Import-Module "C:\Users\adriscoll\repos\ITSM%20and%20Automation%20Modules\ScsmBulkOperations\ScsmBulkOperations.psm1" -Force | |
| Import-Module 'C:\Program Files\Common Files\SMLets\Smlets.psd1' -Force | |
| Add-RandomScsmBulkData -Classes "CITAM.Lun$" -DataSetSize 1 |
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
| Remove-Module 'Smlets' | |
| Import-Module 'C:\Program Files\Common Files\SMLets\SMLets.psd1' -Force | |
| $here = Split-Path -Parent $MyInvocation.MyCommand.Path | |
| Import-Module (Join-Path $here "ScsmBulkOperations.psd1") -Force | |
| Describe "Move-ScsmObject" { | |
| $Session = New-ScsmMigrationSession -SourceComputerName 'SourceComp' -TargetComputerName 'TargetComp' | |
| Context "When classes differ between source and target SCSM (number of properties) and strict specified" { |
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
| /*!-------------------------------------------------------- | |
| * Copyright (C) Microsoft Corporation. All rights reserved. | |
| *--------------------------------------------------------*/.hidden{display:none!important;visibility:hidden!important}.builder-visible{display:inherit;visibility:visible}.monaco-action-bar{text-align:center;overflow:hidden;white-space:nowrap}.monaco-action-bar .actions-container{display:inline-block;margin:0 auto;padding:0;width:100%}.monaco-action-bar .action-item{cursor:pointer;display:inline-block;-webkit-transition:-webkit-transform .1s ease;transition:transform .1s ease;position:relative}.monaco-action-bar .action-item.disabled{cursor:default}.monaco-action-bar .action-item.active{-webkit-transform:translateY(-3px);transform:translateY(-3px)}.monaco-action-bar .action-item .icon{display:inline-block}.monaco-action-bar .action-label{font-size:12px;margin-right:.3em}.monaco-action-bar .action-item.disabled .action-label,.monaco-action-bar .action-item.disabled .action-label:hover{opacit |
OlderNewer