full_path
stringlengths
31
232
filename
stringlengths
4
167
content
stringlengths
0
48.3M
PowerShellCorpus/PowerShellGallery/Cloud.Ready.Software.NAV/1.0.0.8/Apps/Create-NAVAppPackage.ps1
Create-NAVAppPackage.ps1
function Create-NAVAppPackage { [CmdLetBinding()] param([Parameter(Mandatory=$true)] [string] $AppName, [Parameter(Mandatory=$true)] [string] $BuildFolder, [Parameter(Mandatory=$true)] [string] $Publisher, [Parameter(Mandatory=$true)] [string] $Description, [string...
PowerShellCorpus/PowerShellGallery/Cloud.Ready.Software.NAV/1.0.0.8/Apps/Create-NAVAppFiles.ps1
Create-NAVAppFiles.ps1
function Create-NAVAppFiles { <# .Synopsis Create delta's, specifically meant to do NAVApps, which means: including permissionsets and Web Services .DESCRIPTION .NOTES <TODO: Some tips> .PREREQUISITES <TODO: like positioning the prompt and such> #> [C...
PowerShellCorpus/PowerShellGallery/Cloud.Ready.Software.NAV/1.0.0.8/Apps/Create-NAVXFromDB.ps1
Create-NAVXFromDB.ps1
function Create-NAVXFromDB { [CmdLetBinding()] param( [string] $AppName, [String] $AppPublisher, [String] $AppDescription, [string] $BuildFolder, [string] $OriginalServerInstance, [string] $ModifiedServerInstance, [String] $InitialVersion = '1.0....
PowerShellCorpus/PowerShellGallery/Cloud.Ready.Software.NAV/1.0.0.8/SQL/Import-NAVServerLicenseToDatabase.ps1
Import-NAVServerLicenseToDatabase.ps1
function Import-NAVServerLicenseToDatabase { [cmdletbinding()] param( [String] $LicenseFile, [String] $ServerInstance, [ValidateSet('Server','Database')] [String] $Scope ) Write-Verbose "Import-NAVServerLicenseToDatabase to $ServerInstance" $ServerIn...
PowerShellCorpus/PowerShellGallery/Cloud.Ready.Software.NAV/1.0.0.8/SQL/Invoke-NAVSQL.ps1
Invoke-NAVSQL.ps1
function Invoke-NAVSQL { <# .Synopsis Executes a SQL Statement on the database server of an NAV ServerInstance .DESCRIPTION Will return an object model when records were retrieved .NOTES .PREREQUISITES Use Microsoft.Dynamics.NAV.Management module Uses Get-NAVServerInstanceDetails .EXAMPLE...
PowerShellCorpus/PowerShellGallery/Cloud.Ready.Software.NAV/1.0.0.8/ModelTools/Merge-NAVVersionList.ps1
Merge-NAVVersionList.ps1
function Merge-NAVVersionList { param ( [String]$OriginalVersionList, [String]$ModifiedVersionList, [String]$TargetVersionList, [String[]]$Versionprefix ) Write-Verbose "Merging $OriginalVersionList, $ModifiedVersionList, $TargetVersionList" $allVersions = @()...
PowerShellCorpus/PowerShellGallery/Cloud.Ready.Software.NAV/1.0.0.8/ModelTools/Get-NAVHighestVersionList.Tests.ps1
Get-NAVHighestVersionList.Tests.ps1
$Here = Split-Path -Parent $MyInvocation.MyCommand.Path $SystemUnderTest = (Split-Path -Leaf $MyInvocation.MyCommand.Path) -replace '\.Tests\.', '.' . "$Here\$SystemUnderTest" Describe 'Get-NAVHighestVersionList' { It 'Handles simple versions correctly' { Get-NAVHighestVersionList -VersionList1 'NAVW...
PowerShellCorpus/PowerShellGallery/Cloud.Ready.Software.NAV/1.0.0.8/ModelTools/Get-NAVApplicationObjectLanguage.ps1
Get-NAVApplicationObjectLanguage.ps1
Function Get-NAVApplicationObjectLanguage { param( [String] $Source, [String] $WorkingFolder, [String[]] $LanguageId, [Object] $DevelopmentTranslations, [Switch] $NotOnlyMissingTranslations ) $WorkingFolder = Join-Path $WorkingFolder 'GetNAVApplicationObject...
PowerShellCorpus/PowerShellGallery/Cloud.Ready.Software.NAV/1.0.0.8/ModelTools/Remove-NAVVersionFromVersionList.ps1
Remove-NAVVersionFromVersionList.ps1
function Remove-NAVVersionFromVersionList { <# .SYNOPSIS Removes a part of the Version List .DESCRIPTION Removes a part of the Version List .EXAMPLE To remove the prefixes 'I' and 'M' from VersionList 'NAVW17.0,NAVBE7.0,NAVWD7.1,I8.0,M20156' Remove-NAVVersionFromVersionList -VersionList 'NAV...
PowerShellCorpus/PowerShellGallery/Cloud.Ready.Software.NAV/1.0.0.8/ModelTools/Add-NAVVersionListMember.ps1
Add-NAVVersionListMember.ps1
function Add-NAVVersionListMember { param ( [Parameter(Mandatory=$true)] [String]$VersionList, [Parameter(Mandatory=$true)] [String]$AddVersionList ) if ([String]::IsNullOrEmpty($VersionList)) { return $AddVersionList break } if ([St...
PowerShellCorpus/PowerShellGallery/Cloud.Ready.Software.NAV/1.0.0.8/ModelTools/Apply-NAVDelta.ps1
Apply-NAVDelta.ps1
<# .Synopsis Applies a folder with Deltafiles to a Serverinstance .DESCRIPTION Steps: -Export objects .PREREQUISITES - Run on ServiceTier. - NAVModeltools must be present! .EXAMPLE #> Function Apply-NAVDelta { [CmdLetBinding()] param( [parameter(Mandatory=$true)] ...
PowerShellCorpus/PowerShellGallery/Cloud.Ready.Software.NAV/1.0.0.8/ModelTools/Import-NAVApplicationObject2.ps1
Import-NAVApplicationObject2.ps1
<# .Synopsis Alternative for importing objects: only have to provide the ServerInstance .DESCRIPTION The serverinstance provides the details for importing the objects. Assumes that the function is executed on the host where the ServerInstance is installed #> function Import-NAVApplicationObject2 { ...
PowerShellCorpus/PowerShellGallery/Cloud.Ready.Software.NAV/1.0.0.8/ModelTools/Export-NAVApplicationObjects_BasedOnObjectfile.ps1
Export-NAVApplicationObjects_BasedOnObjectfile.ps1
function Export-NAVApplicationObjects_BasedOnObjectfile { [CmdletBinding()] Param ( [Parameter(Mandatory=$true)] [Object] $ObjectFile, [Parameter(Mandatory=$true)] [String] $ServerInstance, [Parameter(Mandatory=$true)] [String] $ResultFolder ...
PowerShellCorpus/PowerShellGallery/Cloud.Ready.Software.NAV/1.0.0.8/ModelTools/Compile-NAVApplicationObject2.ps1
Compile-NAVApplicationObject2.ps1
<# .Synopsis Alternative for Compiling objects: only have to provide the ServerInstance .DESCRIPTION The serverinstance provides the details for Compiling the objects. Assumes that the function is executed on the host where the ServerInstance is installed #> function Compile-NAVApplicationObject2 {...
PowerShellCorpus/PowerShellGallery/Cloud.Ready.Software.NAV/1.0.0.8/ModelTools/Convert-NAVApplicationObjectLanguageKey.ps1
Convert-NAVApplicationObjectLanguageKey.ps1
function Convert-NAVApplicationObjectLanguageKey { param( [String] $KeyToConvert, [String] $ToLanguage ) $KeyObject = Get-NAVApplicationObjectLanguageKeyObject -Key $KeyToConvert $CurrentLanguage = $KeyObject.LCID $KeyToConvert -replace "-A$($CurrentLanguage)-", "-A$(Conve...
PowerShellCorpus/PowerShellGallery/Cloud.Ready.Software.NAV/1.0.0.8/ModelTools/Convert-NAVApplicationObjectLanguageCode.ps1
Convert-NAVApplicationObjectLanguageCode.ps1
function Convert-NAVApplicationObjectLanguageCode{ param( [String] $Convert ) $Languages = @{ '1033'='ENU'; ENU='1033'; '2067'='NLB'; NLB = '2067'; '1030' = 'DAN'; DAN = '1030'; '3079' = 'DEA'; DEA = '3079'; ...
PowerShellCorpus/PowerShellGallery/Cloud.Ready.Software.NAV/1.0.0.8/ModelTools/Export-NAVApplicationObjectLanguageHash.ps1
Export-NAVApplicationObjectLanguageHash.ps1
function Export-NAVApplicationObjectLanguageHash{ param( [String] $Source, [String] $DestinationXML, [Parameter(ValueFromPipeline=$true)] [String[]] $LanguageId, [String] $DevelopmentLanguageId, [String] $WorkingFolder ) Begin{ $TempTextFile ...
PowerShellCorpus/PowerShellGallery/Cloud.Ready.Software.NAV/1.0.0.8/ModelTools/Get-NAVApplicationObjectLanguagePropertyType.ps1
Get-NAVApplicationObjectLanguagePropertyType.ps1
function Get-NAVApplicationObjectLanguagePropertyType { [CmdLetBinding()] param( [Parameter(Mandatory=$True, ValueFromPipeline=$True)] [String] $Key, [Parameter(Mandatory=$True)] [Object] $FinStxHash ) process{ $RegEx = 'P(\d+)' $MatchedR...
PowerShellCorpus/PowerShellGallery/Cloud.Ready.Software.NAV/1.0.0.8/ModelTools/Import-NAVApplicationObjectFromString.ps1
Import-NAVApplicationObjectFromString.ps1
Function Import-NAVApplicationObjectFromString { param( [Parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [String] $ObjectString, [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)] [String] $ServerInstance, [Parameter(Mandatory=$false)]...
PowerShellCorpus/PowerShellGallery/Cloud.Ready.Software.NAV/1.0.0.8/ModelTools/Remove-NAVVersionListMember.ps1
Remove-NAVVersionListMember.ps1
function Remove-NAVVersionListMember { param ( [Parameter(Mandatory=$true)] [String]$VersionList, [Parameter(Mandatory=$true)] [String]$RemoveVersionList ) $allVersions = @() + $VersionList.Split(',') $NewVersionList = @() $allVersions = @() + $Vers...
PowerShellCorpus/PowerShellGallery/Cloud.Ready.Software.NAV/1.0.0.8/ModelTools/Copy-NAVChangedMergedResultFiles.ps1
Copy-NAVChangedMergedResultFiles.ps1
function Copy-NAVChangedMergedResultFiles { [CmdletBinding()] Param( $MergeResultObjects, $DestinationFolder ) $Errors = @() $ObjectsToCopy = $MergeResultObjects | where-Object {($_.MergeResult -ine 'Unchanged') -and ($_.MergeResult -ine 'Failed') -and ($_.MergeResult -ine 'D...
PowerShellCorpus/PowerShellGallery/Cloud.Ready.Software.NAV/1.0.0.8/ModelTools/Merge-NAVApplicationObjectProperty.ps1
Merge-NAVApplicationObjectProperty.ps1
function Merge-NAVApplicationObjectProperty { [CmdletBinding()] Param( [Bool] $UpdateDateTime, [Bool] $UpdateVersionList, [Parameter(Mandatory=$True, ValueFromPipelineByPropertyName=$true)] [Microsoft.Dynamics.Nav.Model.Tools.ApplicationObjectFileInfo] $Original, ...
PowerShellCorpus/PowerShellGallery/Cloud.Ready.Software.NAV/1.0.0.8/ModelTools/Compile-NAVApplicationObjectInParallel.ps1
Compile-NAVApplicationObjectInParallel.ps1
<# Source: https://blogs.msdn.microsoft.com/nav/2014/11/27/how-to-compile-a-database-twice-as-fast-or-faster/ Changed a little bit though.. #> function Compile-NAVApplicationObjectInParallel{ param ( [Parameter(Mandatory=$true)] [String] $ServerInstance, [ValidateSet('Force','No','Y...
PowerShellCorpus/PowerShellGallery/Cloud.Ready.Software.NAV/1.0.0.8/ModelTools/Switch-NAVDate.ps1
Switch-NAVDate.ps1
function Switch-NAVDate{ param( [String] $DateString ) $DateArray = $DateString -split '' $NewDate = ($DateArray[4..5]+ '/' + $DateArray[1..2] + '/' + $DateArray[7..8]) -join '' return $NewDate }
PowerShellCorpus/PowerShellGallery/Cloud.Ready.Software.NAV/1.0.0.8/ModelTools/Apply-NAVDelta2.ps1
Apply-NAVDelta2.ps1
<# .Synopsis Applies a folder with Deltafiles to a Serverinstance .DESCRIPTION Steps: -Export objects .PREREQUISITES - Run on ServiceTier. - NAVModeltools must be present! .EXAMPLE #> Function Apply-NAVDelta2 { [CmdLetBinding()] param( [parameter(Mandatory=$true)] ...
PowerShellCorpus/PowerShellGallery/Cloud.Ready.Software.NAV/1.0.0.8/ModelTools/Export-NAVApplicationObject2.ps1
Export-NAVApplicationObject2.ps1
<# .Synopsis Alternative for exporting objects: only have to provide the ServerInstance .DESCRIPTION The serverinstance provides the details for exporting the objects. Assumes that the function is executed on the host where the ServerInstance is installed #> function Export-NAVApplicationObject2 { ...
PowerShellCorpus/PowerShellGallery/Cloud.Ready.Software.NAV/1.0.0.8/ModelTools/Get-NAVHighestVersionList.ps1
Get-NAVHighestVersionList.ps1
function Get-NAVHighestVersionList { param ( [String]$VersionList1, [String]$VersionList2, [String]$Prefix ) if ([string]::IsNullOrEmpty($Versionlist1)){return $VersionList2} if ([string]::IsNullOrEmpty($Versionlist2)){return $VersionList1} if ($VersionList1 -...
PowerShellCorpus/PowerShellGallery/Cloud.Ready.Software.NAV/1.0.0.8/ModelTools/Create-NAVDelta.ps1
Create-NAVDelta.ps1
function Create-NAVDelta { <# .Synopsis Create delta's, specifically meant to do NAVApps, which means: including permissionsets .DESCRIPTION .NOTES It creates deltas in the 'Appfiles' folder .PREREQUISITES <TODO: like positioning the prompt and such> ...
PowerShellCorpus/PowerShellGallery/Cloud.Ready.Software.NAV/1.0.0.8/ModelTools/Export-NAVALfromNAVApplicationObject.ps1
Export-NAVALfromNAVApplicationObject.ps1
function Export-NAVALfromNAVApplicationObject { param ( [String]$ServerInstance, [String]$WorkingFolder, [String]$TargetPath, [String]$Filter, [Switch]$OpenResultFolderInVSCode )   #Import NAV Modules - we need the $NAVIde Import-NAVModules | Out-...
PowerShellCorpus/PowerShellGallery/Cloud.Ready.Software.NAV/1.0.0.8/ModelTools/Delete-NAVApplicationObject2.ps1
Delete-NAVApplicationObject2.ps1
’╗┐<# .Synopsis Alternative for Deleting objects: only have to provide the ServerInstance .DESCRIPTION The serverinstance provides the details for Deleting the objects. Assumes that the function is executed on the host where the ServerInstance is installed #> function Delete-NAVApplicationObject2 {...
PowerShellCorpus/PowerShellGallery/Cloud.Ready.Software.NAV/1.0.0.8/ModelTools/Get-NAVDate.ps1
Get-NAVDate.ps1
function Get-NAVDate { param( [String] $DateStringFromNAVObjectFile, [String] $Format ) try { Get-date $DateStringFromNAVObjectFile -Format $Format} catch { Get-date (Switch-NAVDate -DateString $DateString) -Format $Format} }
PowerShellCorpus/PowerShellGallery/Cloud.Ready.Software.NAV/1.0.0.8/ModelTools/Merge-NAVDateTime.ps1
Merge-NAVDateTime.ps1
function Merge-NAVDateTime { param ( [String]$OriginalDate, [String]$OriginalTime, [String]$ModifiedDate, [String]$ModifiedTime, [String]$TargetDate, [String]$TargetTime, [Switch]$SwitchOriginalDate, [Switch]$SwitchModifiedDate, [Swi...
PowerShellCorpus/PowerShellGallery/Cloud.Ready.Software.NAV/1.0.0.8/ModelTools/Get-NAVApplicationObjectLanguageKeyObject.ps1
Get-NAVApplicationObjectLanguageKeyObject.ps1
function Get-NAVApplicationObjectLanguageKeyObject{ param( [Parameter(Mandatory=$True, ValueFromPipeline=$True)] [String] $Key, [Parameter(Mandatory=$false)] [Object] $FinStxHash ) process{ #ObjectType switch ($Key[0]){ 'T'{$ObjectType ...
PowerShellCorpus/PowerShellGallery/Cloud.Ready.Software.NAV/1.0.0.8/ModelTools/Get-NAVApplicationObjectDevelopmentLanguage.ps1
Get-NAVApplicationObjectDevelopmentLanguage.ps1
function Get-NAVApplicationObjectDevelopmentLanguage{ param( [String] $SourceXML ) $Dictionary = Import-Clixml $SourceXML return $Dictionary }
PowerShellCorpus/PowerShellGallery/Cloud.Ready.Software.NAV/1.0.0.8/ModelTools/Export-NAVApplicationObjectDevelopmentLanguage.ps1
Export-NAVApplicationObjectDevelopmentLanguage.ps1
function Export-NAVApplicationObjectDevelopmentLanguage{ param( [String] $Source, [String] $DestinationXML, [String] $DevelopmentLanguageId, [String] $WorkingFolder ) $DevLanguage = Export-NAVApplicationObjectLanguage ` -Source $Source ` ...
PowerShellCorpus/PowerShellGallery/Cloud.Ready.Software.NAV/1.0.0.8/ModelTools/Merge-NAVUpgradeObjects.ps1
Merge-NAVUpgradeObjects.ps1
function Merge-NAVUpgradeObjects { [CmdLetBinding()] param( [String] $OriginalObjects, [String] $ModifiedObjects, [String] $TargetObjects, [String] $WorkingFolder, [Switch] $Force, [Switch] $CreateDeltas, [String[]] $VersionListPrefixes, ...
PowerShellCorpus/PowerShellGallery/Cloud.Ready.Software.NAV/1.0.0.8/ModelTools/Fix-NAVTime.ps1
Fix-NAVTime.ps1
Function Fix-NAVTime { param( [String] $TimeString ) $Result = $TimeString if ($TimeString.Length -eq 11) { $Result = $TimeString[0..7] -join '' } return $Result }
PowerShellCorpus/PowerShellGallery/Cloud.Ready.Software.NAV/1.0.0.8/Upgrade/Get-NAVCumulativeUpdateFile_OLD.ps1
Get-NAVCumulativeUpdateFile_OLD.ps1
#requires -Version 3 -Modules BitsTransfer #Author: Kamil, based on ideas from waldo (who had it developed in .Net) :-) <# .Synopsis Download the Cumulative Update File for specified NAV version and localization .DESCRIPTION Download the Cumulative Update File for specified NAV version and localiz...
PowerShellCorpus/PowerShellGallery/Cloud.Ready.Software.NAV/1.0.0.8/Upgrade/New-NAVCumulativeUpdateISOFile.ps1
New-NAVCumulativeUpdateISOFile.ps1
function New-NAVCumulativeUpdateISOFile { <# .SYNOPSIS Creates an ISO file from a cumulative Update Download exe #> [CmdletBinding()] param ( [Parameter(Mandatory=$true, Position=0)] [System.String] $CumulativeUpdateFullPath, [Par...
PowerShellCorpus/PowerShellGallery/Cloud.Ready.Software.NAV/1.0.0.8/Upgrade/Load-NAVCumulativeUpdateHelper.ps1
Load-NAVCumulativeUpdateHelper.ps1
<# .Synopsis Loads a .Net assembly to easily find Microsoft Dynamics NAV downloads in the Microsoft Download Center. .DESCRIPTION Compiles C# in memory and gives you 2 static functions: static System.Collections.Generic.IEnumerable[MicrosoftDownload.NAVDownload] GetDownloadLoca...
PowerShellCorpus/PowerShellGallery/Cloud.Ready.Software.NAV/1.0.0.8/Upgrade/Get-NAVCumulativeUpdateFileName.ps1
Get-NAVCumulativeUpdateFileName.ps1
function Get-NAVCumulativeUpdateFileName { [CmdletBinding()] Param ( [Parameter(Mandatory=$true)] [String] $FullPathToZip, [Parameter(Mandatory=$false)] [String] $Subfolder='', [Parameter(Mandatory=$true)] [String] $Filter ) $SourcePa...
PowerShellCorpus/PowerShellGallery/Cloud.Ready.Software.NAV/1.0.0.8/Upgrade/Get-NAVCumulativeUpdateDownloadVersionInfo.ps1
Get-NAVCumulativeUpdateDownloadVersionInfo.ps1
function Get-NAVCumulativeUpdateDownloadVersionInfo { [CmdletBinding()] Param ( [Parameter(Mandatory=$true)] [String] $SourcePath ) Begin { } Process { $ZipFileName = Get-NAVCumulativeUpdateFileName -FullPathToZip $SourcePath -Filter '*.zip' ...
PowerShellCorpus/PowerShellGallery/Cloud.Ready.Software.NAV/1.0.0.8/Upgrade/Start-NAVUpgradeDatabaseMT.ps1
Start-NAVUpgradeDatabaseMT.ps1
function Start-NAVUpgradeDatabaseMT { <# .SYNOPSIS Upgrades a database in the Multi Tenancy-way: by creating an app-db, mounting the old db as a tenant, an performing the data-upgrade like that (avoiding the classic database conversion) #> [CmdLetBinding()] param( [String...
PowerShellCorpus/PowerShellGallery/Cloud.Ready.Software.NAV/1.0.0.8/Upgrade/Unzip-NAVCumulativeUpdateChangedObjects.ps1
Unzip-NAVCumulativeUpdateChangedObjects.ps1
function Unzip-NAVCumulativeUpdateChangedObjects { [CmdletBinding()] Param ( # The full source-filepath of the file that should be unzipped [Parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] [Alias('Fullname')] $SourcePath, ...
PowerShellCorpus/PowerShellGallery/Cloud.Ready.Software.NAV/1.0.0.8/Upgrade/New-NAVUpgradeApplicationDB.ps1
New-NAVUpgradeApplicationDB.ps1
function New-NAVUpgradeApplicationDB { [CmdLetBinding()] param( [String] $TargetServerInstance, [String] $LicenseFile, [String] $TextFileFolder, [String] $WorkingFolder, [String] $Name ) write-Host -foregroundColor Green -Object 'Creating Multi Tenant ...
PowerShellCorpus/PowerShellGallery/Cloud.Ready.Software.NAV/1.0.0.8/Upgrade/Export-NAVCumulativeUpdateApplicationObjects.ps1
Export-NAVCumulativeUpdateApplicationObjects.ps1
function Export-NAVCumulativeUpdateApplicationObjects { [CmdletBinding()] Param ( [Parameter(Mandatory=$true)] [Object] $CUObjectFile, [Parameter(Mandatory=$true)] [String] $ServerInstance, [Parameter(Mandatory=$true)] [String] $Workingfolder ...
PowerShellCorpus/PowerShellGallery/Cloud.Ready.Software.NAV/1.0.0.8/Upgrade/New-NAVUpgradeFobFromMergedText.ps1
New-NAVUpgradeFobFromMergedText.ps1
function New-NAVUpgradeFobFromMergedText { [CmdLetBinding()] param( [String] $TargetServerInstance, [String] $LicenseFile, [String] $TextFileFolder, [String] $WorkingFolder, [String] $FobFileForCreatingUnlicensedObjects, [String] $ResultFobFile,...
PowerShellCorpus/PowerShellGallery/Cloud.Ready.Software.NAV/1.0.0.8/Upgrade/Remove-NAVUpgradeObjectLanguage.ps1
Remove-NAVUpgradeObjectLanguage.ps1
Function Remove-NAVUpgradeObjectLanguage { [CmdLetBinding()] param( [String] $Source, [String] $WorkingFolder, [String[]] $Languages ) $FileObject = get-item $Source -ErrorAction Stop $ObjectsWithoutLanguages = (join-path $WorkingFolder "$($FileObject.BaseName)...
PowerShellCorpus/PowerShellGallery/Cloud.Ready.Software.NAV/1.0.0.8/Upgrade/Get-NAVCumulativeUpdateFileFromKBArticleURL.ps1
Get-NAVCumulativeUpdateFileFromKBArticleURL.ps1
function Get-NAVCumulativeUpdateFileFromKBArticleURL { param ( [Parameter(ValueFromPipelineByPropertyName)] $KBArticleURL, [Parameter(ValueFromPipelineByPropertyName)] $DownloadFolder = $env:TEMP, [Parameter(ValueFromPipelineByPropertyName)] $CountryCodes = 'W1...
PowerShellCorpus/PowerShellGallery/Cloud.Ready.Software.NAV/1.0.0.8/Upgrade/Start-NAVUpgradeDatabase.ps1
Start-NAVUpgradeDatabase.ps1
function Start-NAVUpgradeDatabase { <# .SYNOPSIS Upgrades a database the classic way: applies a fob-file on a converted database #> [CmdLetBinding()] param( [String] $Name, [String] $DatabaseBackupFile, [String] $ResultObjectFile, [Str...
PowerShellCorpus/PowerShellGallery/Cloud.Ready.Software.NAV/1.0.0.8/Upgrade/Get-NAVCumulativeUpdateFile.ps1
Get-NAVCumulativeUpdateFile.ps1
<# .Synopsis Downloads a Cumulative Update from the Microsoft Download Center .DESCRIPTION Based on the Microsoft Dynamics NAV Team Blog, this function is going to download a cumulative update to a download folder. The function uses the download helper (Load-NAVCumulativeUpdateHelpe...
PowerShellCorpus/PowerShellGallery/Cloud.Ready.Software.NAV/1.0.0.8/Management/Get-NAVVersion.ps1
Get-NAVVersion.ps1
function Get-NAVVersion { $file = Get-ChildItem -Path c:\ -Recurse -Filter 'Microsoft.Dynamics.NAV*.dll' | select -First 1 if(!$file){ Write-Error 'NAV not found on this system!' } else { [System.Diagnostics.FileVersionInfo]::GetVersionInfo($file.FullName).FileVersion } }
PowerShellCorpus/PowerShellGallery/Cloud.Ready.Software.NAV/1.0.0.8/Management/Get-NAVCompany2.ps1
Get-NAVCompany2.ps1
function Get-NAVCompany2 { [CmdletBinding()] param ( [parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)] [String]$ServerInstance, [parameter(Mandatory=$false,ValueFromPipelineByPropertyName=$true)] [String]$Id="Default" ) BEGIN { $Res...
PowerShellCorpus/PowerShellGallery/Cloud.Ready.Software.NAV/1.0.0.8/Installation/Uninstall-NAVFromISO.ps1
Uninstall-NAVFromISO.ps1
function UnInstall-NAVFromISO { <# .SYNOPSIS Installs NAV from an ISO file #> [CmdletBinding()] param ( [Parameter(Mandatory=$true, Position=0)] [System.String] $ISOFilePath, [Parameter(Mandatory=$true, Position=0)] [System.String]...
PowerShellCorpus/PowerShellGallery/Cloud.Ready.Software.NAV/1.0.0.8/Installation/Install-NAVFromISO.ps1
Install-NAVFromISO.ps1
function Install-NAVFromISO { <# .SYNOPSIS Installs NAV from an ISO file #> [CmdletBinding()] param ( [Parameter(Mandatory=$true, Position=0)] [System.String] $ISOFilePath, [Parameter(Mandatory=$true, Position=1)] [Object...
PowerShellCorpus/PowerShellGallery/Cloud.Ready.Software.NAV/1.0.0.8/Installation/Repair-NAVFromISO.ps1
Repair-NAVFromISO.ps1
function Repair-NAVFromISO { [CmdletBinding()] Param ( [Parameter(Mandatory=$true, Position=0)] [System.String] $ISOFilePath, [Parameter(Mandatory=$true, Position=2)] [System.String] $Log ) process { $...
PowerShellCorpus/PowerShellGallery/Cloud.Ready.Software.NAV/1.0.0.8/Installation/Repair-NAV.ps1
Repair-NAV.ps1
function Repair-NAV { [CmdletBinding()] Param ( [Parameter(Mandatory=$true)] [String] $DVDFolder, [Parameter(Mandatory=$true)] [String] $Log ) process { write-host -foregroundcolor green -object 'Repairing NAV Installation ...' write...
PowerShellCorpus/PowerShellGallery/Cloud.Ready.Software.NAV/1.0.0.8/Installation/Uninstall-NAV.ps1
Uninstall-NAV.ps1
function UnInstall-NAV { [CmdletBinding()] Param ( [String] $DVDFolder, [String] $Log ) process { #Install write-host 'Uninstalling NAV...' -ForegroundColor Green if ($DVDFolder.Length -eq 3){ $SetupPath = "$($DVDFolder)s...
PowerShellCorpus/PowerShellGallery/Cloud.Ready.Software.NAV/1.0.0.8/Installation/Install-NAV.ps1
Install-NAV.ps1
function Install-NAV { [CmdletBinding()] Param ( [Parameter(Mandatory=$true)] [String] $DVDFolder, [Parameter(Mandatory=$true)] $Configfile, [Parameter(Mandatory=$false)] $LicenseFile, [Parameter(Mandatory=$true)] $Log, [Pa...
PowerShellCorpus/PowerShellGallery/POSHOrigin/1.7.1/DSCResources/POSHOrigin_POSHFile/Invoke.ps1
Invoke.ps1
<# This script expects to be passed a psobject with all the needed properties in order to invoke a 'VirtualMachine' DSC resource. #> [cmdletbinding()] param( [parameter(mandatory)] [psobject]$Options, [bool]$Direct = $false ) # Ensure we have a valid 'ensure' property if ($null -eq $Options.option...
PowerShellCorpus/PowerShellGallery/POSHOrigin/1.7.1/DSCResources/POSHOrigin_POSHFolder/Invoke.ps1
Invoke.ps1
<# This script expects to be passed a psobject with all the needed properties in order to invoke a 'VirtualMachine' DSC resource. #> [cmdletbinding()] param( [parameter(mandatory)] [psobject]$Options, [bool]$Direct = $false ) # Ensure we have a valid 'ensure' property if ($null -eq $Options.option...
PowerShellCorpus/PowerShellGallery/POSHOrigin/1.7.1/Internal/_WriteScreen.ps1
_WriteScreen.ps1
function _WriteScreen { #wraps the Write-Verbose cmdlet to control colors [cmdletbinding()] param( [Object]$Object, [Switch]$NoNewline, #[Object]$Separator, #[Switch]$Quiet = ($VerbosePreference -eq 'SilentlyContinue'), [Switch]$Quiet = $false, [ValidateSet('...
PowerShellCorpus/PowerShellGallery/POSHOrigin/1.7.1/Internal/_LoadConfig.ps1
_LoadConfig.ps1
function _LoadConfig { [cmdletbinding()] param( [parameter(Mandatory)] [string]$Path, [switch]$Recurse ) $configs = @() $item = Get-Item -Path $Path if ($item.PSIsContainer) { $files = Get-ChildItem -Path $item -Filter '*.ps1' -Recurse:$Recurse } else { ...
PowerShellCorpus/PowerShellGallery/POSHOrigin/1.7.1/Internal/_SetupLCM.ps1
_SetupLCM.ps1
function _SetupLCM { [cmdletbinding()] param() [DscLocalConfigurationManager()] configuration LCMPush { param ( [string] $Computer = 'localhost' ) node $Computer { Settings { RefreshMode = 'Push' ConfigurationMode = 'Apply...
PowerShellCorpus/PowerShellGallery/POSHOrigin/1.7.1/Internal/_IsSessionElevated.ps1
_IsSessionElevated.ps1
function _IsSessionElevated { $Identity = [System.Security.Principal.WindowsIdentity]::GetCurrent() $Principal = New-Object System.Security.Principal.WindowsPrincipal($Identity) return $Principal.IsInRole([System.Security.Principal.WindowsBuiltInRole]::Administrator) }
PowerShellCorpus/PowerShellGallery/POSHOrigin/1.7.1/Internal/_GetOption.ps1
_GetOption.ps1
function _GetOption { [cmdletbinding()] param( [Parameter(Mandatory)] [string]$Option = [string]::empty, [string]$repo = (Join-Path -path $env:USERPROFILE -ChildPath '.poshorigin') ) if (Test-Path -Path $repo -Verbose:$false) { $options = (Join-Path -Path $repo -ChildPa...
PowerShellCorpus/PowerShellGallery/POSHOrigin/1.7.1/Internal/_WriteHost.ps1
_WriteHost.ps1
enum MsgType { File = [ConsoleColor]::Magenta Module = [ConsoleColor]::Cyan Resource = [ConsoleColor]::Yellow ResourceDetail = [ConsoleColor]::Green } enum MsgTypeDepth { File = 1 Module = 2 Resource = 3 ResourceDetail = 4 } function _WriteHost { param( [string]$Message, ...
PowerShellCorpus/PowerShellGallery/POSHOrigin/1.7.1/Internal/_CopyObject.ps1
_CopyObject.ps1
function _CopyObject { # http://stackoverflow.com/questions/7468707/deep-copy-a-dictionary-hashtable-in-powershell [outputtype([system.object])] [cmdletbinding()] param( [Parameter(Mandatory)] [system.object]$DeepCopyObject = $null ) $memStream = new-object -TypeName IO.MemorySt...
PowerShellCorpus/PowerShellGallery/POSHOrigin/1.7.1/Internal/_MergeHashtables.ps1
_MergeHashtables.ps1
function _MergeHashtables { <# .SYNOPSIS Merges two hashtables together and returns the result .DESCRIPTION When adding two hashes together, an error will be thrown if there are duplicate keys in the table. The order in which the hashtables are passed to the function is very important. So the...
PowerShellCorpus/PowerShellGallery/POSHOrigin/1.7.1/Internal/_GetDSCResource.ps1
_GetDSCResource.ps1
# Tries to resolve the given DSC resource function _GetDscResource { param( [string]$Resource, [string]$Module ) $dscResource = Get-DscResource -Name $Resource -Module $Module -ErrorAction SilentlyContinue -WarningAction SilentlyContinue -Verbose:$false if (-Not $dscResource) { ...
PowerShellCorpus/PowerShellGallery/POSHOrigin/1.7.1/Internal/_getHash.ps1
_getHash.ps1
<# .SYNOPSIS Gets the hash value of a file or string .DESCRIPTION Gets the hash value of a file or string It uses System.Security.Cryptography.HashAlgorithm (http://msdn.microsoft.com/en-us/library/system.security.cryptography.hashalgorithm.aspx) and FileStream Class (http://msdn.microsoft.com/en-us/library/system.io...
PowerShellCorpus/PowerShellGallery/POSHOrigin/1.7.1/Internal/_MakeObject.ps1
_MakeObject.ps1
function _MakeObject { param ( [Parameter( Position = 0, Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true )] [object[]]$hashtable ) begin { $i = 0 } process { foreach ($myHashtable...
PowerShellCorpus/PowerShellGallery/POSHOrigin/1.7.1/Internal/_SortByDependency.ps1
_SortByDependency.ps1
#Thank the FSM for the internets! # http://rosettacode.org/wiki/Topological_sort#PowerShell # http://stackoverflow.com/questions/8982782/does-anyone-have-a-dependency-graph-and-topological-sorting-code-snippet-for-pow function _SortByDependency { [cmdletbinding()] param( [Parameter(Mandatory, ValueFrom...
PowerShellCorpus/PowerShellGallery/POSHOrigin/1.7.1/Internal/_GetDSCResourcePropertyHash.ps1
_GetDSCResourcePropertyHash.ps1
function _GetDSCResourcePropertyHash { param( $DscResource, $Resource ) $hash = @{} # Test for 'Invoke.ps1' script in DSC resource module and optionally use it to translate our options into what the # DSC resource expects. # If there is no 'Invoke.ps1' script or we specified '...
PowerShellCorpus/PowerShellGallery/POSHOrigin/1.7.1/Internal/_ParsePsd1.ps1
_ParsePsd1.ps1
function _ParsePsd1 { # http://stackoverflow.com/questions/25408815/how-to-read-powershell-psd1-files-safely [outputtype([hashtable])] [CmdletBinding()] Param ( [Parameter(Mandatory)] [Microsoft.PowerShell.DesiredStateConfiguration.ArgumentToConfigurationDataTransformation()] [ha...
PowerShellCorpus/PowerShellGallery/POSHOrigin/1.7.1/Internal/_ConvertToDscResourceHash.ps1
_ConvertToDscResourceHash.ps1
function _ConvertToDscResourceHash { [cmdletbinding()] param( [parameter(Mandatory, ValueFromPipeline)] [ValidateScript({ $_.PSObject.TypeNames[0] -eq 'POSHOrigin.Resource' })] [pscustomobject[]]$InputObject ) begin { } process { foreach ($item in $Inpu...
PowerShellCorpus/PowerShellGallery/POSHOrigin/1.7.1/Internal/_CompileConfig.ps1
_CompileConfig.ps1
function _CompileConfig { [cmdletbinding(SupportsShouldProcess)] param( [string]$ProvisioningServer = (_GetOption -Option 'provisioning_server'), [Parameter(Mandatory)] $ConfigData #$Certificate = "$(Join-Path -path $env:USERPROFILE -ChildPath '.poshorigin')\$($Provisio...
PowerShellCorpus/PowerShellGallery/POSHOrigin/1.7.1/Internal/_ConvertFrom-Hashtable.ps1
_ConvertFrom-Hashtable.ps1
function _ConvertFrom-Hashtable { [OutputType([system.object[]])] [cmdletbinding()] param( [parameter(Mandatory, ValueFromPipeline)] [HashTable]$hashtable = @{}, [switch]$combine, [switch]$recurse ) begin { $output = @() } process { if ($re...
PowerShellCorpus/PowerShellGallery/POSHOrigin/1.7.1/Resolvers/PSCredential/Resolve.ps1
Resolve.ps1
[cmdletbinding()] param( [parameter(Mandatory)] [psobject]$Options = $null ) begin { Write-Debug -Message $msgs.rslv_pscredential_begin } process { $keySecure = $options.password | ConvertTo-SecureString -AsPlainText -Force $cred = New-Object System.Management.Automation.PSCredential -ArgumentList...
PowerShellCorpus/PowerShellGallery/POSHOrigin/1.7.1/Resolvers/ProtectedData/Resolve.ps1
Resolve.ps1
[cmdletbinding()] param( [parameter(Mandatory)] [psobject]$Options = $null ) begin { Write-Debug -Message $msgs.rslv_protecteddata_begin } process { if (Get-Module -ListAvailable -Name 'ProtectedData' -Verbose:$false) { Import-Module -Name 'ProtectedData' -Verbose:$false $xmlPath = $Op...
PowerShellCorpus/PowerShellGallery/POSHOrigin/1.7.1/Resolvers/PasswordState/Resolve.ps1
Resolve.ps1
[cmdletbinding()] param( [parameter(Mandatory)] [psobject]$Options = $null ) begin { Write-Debug -Message $msgs.rslv_passwordstate_begin } process { # Do something with the passed in options and return a [pscredential] if (Get-Module -ListAvailable -Name 'PasswordState' -Verbose:$false) { ...
PowerShellCorpus/PowerShellGallery/POSHOrigin/1.7.1/Examples/multiple_resources.ps1
multiple_resources.ps1
resource 'poshorigin:poshfolder' 'folder01' @{ description = 'this is an exmaple folder' ensure = 'present' path = 'c:\' } resource 'poshorigin:poshfile' 'file1' @{ name = 'file1.txt' description = 'this is an example file' ensure = 'present' path = 'c:\folder01' contents = 'this is som...
PowerShellCorpus/PowerShellGallery/POSHOrigin/1.7.1/Examples/using_defaults.ps1
using_defaults.ps1
resource 'poshorigin:poshfolder' 'folder01' @{ defaults = '.\folder_defaults.psd1' } resource 'poshorigin:poshfile' 'file1.txt' @{ defaults = '.\file_defaults.psd1' description = 'this is an example file' } resource 'poshorigin:poshfile' 'file2.txt' @{ defaults = '.\file_defaults.psd1' description...
PowerShellCorpus/PowerShellGallery/POSHOrigin/1.7.1/Examples/single_resource.ps1
single_resource.ps1
resource 'poshorigin:poshfolder' 'folder01' @{ description = 'this is an exmaple folder' ensure = 'present' path = 'c:\' }
PowerShellCorpus/PowerShellGallery/POSHOrigin/1.7.1/ResourceDesignerScripts/GenerateARMDeployment.ps1
GenerateARMDeployment.ps1
#Requires -Modules xDSCResourceDesigner $Name = New-xDscResourceProperty -Name Name -Type String -Attribute Key -Description 'Name of the ARM deployment' $Ensure = New-xDscResourceProperty -Name Ensure -Type String -Attribute Required -ValidateSet "Present", "Absent" -Description 'Ensure that the ARM deployment matche...
PowerShellCorpus/PowerShellGallery/POSHOrigin/1.7.1/Functions/Invoke-POSHOriginNEW.ps1
Invoke-POSHOriginNEW.ps1
function Invoke-POSHOriginNEW { <# .SYNOPSIS Invokes a POSHOrigin configuration directly by calling Invoke-DscResource. ** THIS IS AN EXPERIMENTAL CMDLET AND MAY BE SIGNIFICANTLY MODIFIED IN FUTURE VERSIONS ** .DESCRIPTION Invokes a POSHOrigin configu...
PowerShellCorpus/PowerShellGallery/POSHOrigin/1.7.1/Functions/Invoke-POSHOrigin.ps1
Invoke-POSHOrigin.ps1
function Invoke-POSHOrigin { <# .SYNOPSIS Compiles and invokes a POSHOrigin configuration. .DESCRIPTION Compiles and invokes a POSHOrigin configuration. The custom object(s) passed into this function will be translated into DSC resource(s) and a DSC configuration ...
PowerShellCorpus/PowerShellGallery/POSHOrigin/1.7.1/Functions/Initialize-POSHOrigin.ps1
Initialize-POSHOrigin.ps1
function Initialize-POSHOrigin { <# .SYNOPSIS Initializes the POSHOrigin configuration repository, configures the LCM, and adjusts WSMan settings. .DESCRIPTION - Initializes the POSHOrigin configuration repository that will hold default values for cmdlet parameters. ...
PowerShellCorpus/PowerShellGallery/POSHOrigin/1.7.1/Functions/Get-POSHDefault.ps1
Get-POSHDefault.ps1
function Get-POSHDefault { <# .SYNOPSIS Retrieves a POSHOrigin configuration snippet .DESCRIPTION Retrieves a POSHOrigin configuration snippet as a hashtable that will be merged with the calling configuration resource. Useful for re-using partial configuration op...
PowerShellCorpus/PowerShellGallery/POSHOrigin/1.7.1/Functions/New-POSHOriginResourceFromModule.ps1
New-POSHOriginResourceFromModule.ps1
function New-POSHOriginResourceFromModule { <# .SYNOPSIS Returns POSHOrigin resource(s) defined in a given folder. .DESCRIPTION Returns POSHOrigin resource(s) defined in a given folder. If a .ps1 script with the same name as the module folder is found, only that ...
PowerShellCorpus/PowerShellGallery/POSHOrigin/1.7.1/Functions/Get-POSHOriginConfig.ps1
Get-POSHOriginConfig.ps1
function Get-POSHOriginConfig { <# .SYNOPSIS Reads and processes a POSHOrigin configuration file. .DESCRIPTION Reads and processes a POSHOrigin configuration file and returns the result as one or more PowerShell custom objects containing the required options that ...
PowerShellCorpus/PowerShellGallery/POSHOrigin/1.7.1/Functions/New-POSHOriginResource.ps1
New-POSHOriginResource.ps1
function New-POSHOriginResource { <# .SYNOPSIS Returns a POSHOrigin resource containing the options specified. .DESCRIPTION Returns a POSHOrigin resource containing the options specified. .PARAMETER ResourceType The module name and DSC resource name this P...
PowerShellCorpus/PowerShellGallery/POSHOrigin/1.7.1/Functions/Get-POSHOriginSecret.ps1
Get-POSHOriginSecret.ps1
function Get-POSHOriginSecret { <# .SYNOPSIS Returns a PowerShell credential object using a given resolver name and options. .DESCRIPTION Returns a PowerShell credential object using a given resolver name and options. .PARAMETER Resolver The name of the cr...
PowerShellCorpus/PowerShellGallery/SystemLocaleDsc/1.1.0.0/Examples/SetSystemLocale.ps1
SetSystemLocale.ps1
<# This example will set the System Locale of LocalHost to 'ja-JP'. To use this example, run it using PowerShell. #> Configuration SetSystemLocale { param ( [String[]] $NodeName = $env:COMPUTERNAME, [Parameter(Mandatory = $true)] [ValidateNotNullorEmpty()] [String]...
PowerShellCorpus/PowerShellGallery/SystemLocaleDsc/1.1.0.0/Tests/Unit/MSFT_SystemLocale.Tests.ps1
MSFT_SystemLocale.Tests.ps1
$script:DSCModuleName = 'SystemLocaleDsc' $script:DSCResourceName = 'MSFT_SystemLocale' #region HEADER # Unit Test Template Version: 1.1.0 [String] $moduleRoot = Split-Path -Parent (Split-Path -Parent (Split-Path -Parent $Script:MyInvocation.MyCommand.Path)) if ( (-not (Test-Path -Path (Join-Path -Path $...
PowerShellCorpus/PowerShellGallery/SystemLocaleDsc/1.1.0.0/Tests/Integration/MSFT_SystemLocale.config.ps1
MSFT_SystemLocale.config.ps1
$TestSystemLocale = @{ SystemLocale = 'fr-FR' IsSingleInstance = 'Yes' } configuration MSFT_SystemLocale_Config { Import-DscResource -ModuleName SystemLocaleDsc node localhost { SystemLocale Integration_Test { SystemLocale = $TestSystemLocale.SystemLocale ...
PowerShellCorpus/PowerShellGallery/SystemLocaleDsc/1.1.0.0/Tests/Integration/MSFT_SystemLocale.Integration.Tests.ps1
MSFT_SystemLocale.Integration.Tests.ps1
$script:DSCModuleName = 'SystemLocaleDsc' $script:DSCResourceName = 'MSFT_SystemLocale' #region HEADER # Integration Test Template Version: 1.1.0 [String] $moduleRoot = Split-Path -Parent (Split-Path -Parent (Split-Path -Parent $Script:MyInvocation.MyCommand.Path)) if ( (-not (Test-Path -Path (Join-Path ...
PowerShellCorpus/PowerShellGallery/xPython/1.0.1/Example/Sample_xPython.ps1
Sample_xPython.ps1
# Powershell DSC Configuration Script for installing Python versions 3.4.3, 3.4.2, 2.7.9, and 2.7.10 on Windows # Vasken Houdoverdov # # Each of these calls to Sample_InstallxPython will generate a MOF file which can be fed into Start-DscConfiguration # # Python Version 3.4.3, 64-bit: # Sample_InstallxPython -Ve...
PowerShellCorpus/PowerShellGallery/AzureAutomationDebug/1.3.8/PublishModule.ps1
PublishModule.ps1
$ModuleName = "AzureAutomationDebug" $Tags = "Azure","AzureAutomation" $ProjectSite = "https://github.com/trondhindenes/AzureAutomationDebug" $LicenseUri = "https://raw.githubusercontent.com/trondhindenes/AzureAutomationDebug/master/LICENSE.md" $mod = get-module $ModuleName -list $GalleryMod = Find-Module -Nam...
PowerShellCorpus/PowerShellGallery/AzureAutomationDebug/1.3.8/Connect-AzureRest.ps1
Connect-AzureRest.ps1
Function Connect-AzureRest { Param ($username, $password) $body = "resource=https://management.core.windows.net/&client_id=1950a258-227b-4e31-a9cf-717495945fc2&grant_type=password&username=$username&scope=openid&password=$password" try { $result = invoke-restmethod -Uri "https://login.wi...