Giter Site home page Giter Site logo

cloud.ready.software.powershell's Introduction

Cloud.Ready.Software.PowerShell

waldo's PowerShell Scripts & Modules

Modules

  • Cloud.Ready.Software.NAV

    This module contains functions that has anything to do with NAV.

  • Cloud.Ready.Software.PowerShell

    This module contains various PowerShell helper functions.

  • Cloud.Ready.Software.SQL

    This module contains functions that has anything to do with SQL, like backups, restores, and invoking queries.

  • Cloud.Ready.Software.Windows

    This module has typical Windows related functions such as zip and unzip, working with streams, file management, ISO files, etc.

Scripts

The PSScripts directory contains many subdirectories. These are scripts that use the modules in various ways to perform various day to day tasks. You will likely edit or create your own scripts.

Installation

The source contains a few scripts to help you easily install and configure the PowerShell modules.

Installing the modules

The main part of the installation is the InstallModules.ps1 script. It will make the modules available to the system by updating your PSModules-path. On top of that, it will load the modules when you start a new PowerShell session so you don’t need to do it any more.

To install, run the InstallModules.ps1 script in the PSModules directory. It is important that you do this in a PowerShell session running as administrator.

Create profile in PowerShell ISE

To add some handy menu items in the PowerShell ISE you can use the CreateProfileInISE.ps1 script in the PSModules directory.

Open the PowerShell ISE as an administrator and run the CreateProfileInISE.ps1 script. Now restart your PowerShell ISE. The new menu items should be available in the Add-ons menu.

Reload the modules

In case you edit any of the modules you will have to reload the modules (or restart your PowerShell session).

The modules can be reloaded using either the PowerShell ISE add-on menu items or using the LoadModules.ps1 script in the PSModules directory.

cloud.ready.software.powershell's People

Contributors

danditomaso avatar fvet avatar greatscott000 avatar hvogelpohl avatar jhoek avatar kfuglsang avatar koubek avatar simonofhh avatar sorenklemmensen avatar swisssalaryboris avatar waldo1001 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cloud.ready.software.powershell's Issues

Long running query when using Invoke-SQL needs timeout setting

Hi when using Invoke-SQL to restore a snapshot I encountered a time-out.
This left the database in restoring state.
Would be nice to have a timeout parameter added to Invoke-SQL, i.e. like this:
Invoke-SQL_SLOW -DatabaseServer $DatabaseServer -DatabaseName 'master' -SQLCommand $RestoreSnapshotSQL -Verbose -ErrorAction Stop -TimeOut 10000

Altered version of Invoke SQL:

function Invoke-SQL_SLOW {
    [CmdLetBinding()]
    param(
        [string] $DatabaseServer = [net.dns]::gethostname(),
        [String] $DatabaseInstance = '',
        [string] $DatabaseName = 'Master',
        [string] $SQLCommand = $(throw 'Please specify a query.'),
        [string] $TimeOut = 30
      )

    if (!([string]::IsNullOrEmpty($DatabaseInstance))){
        $DatabaseServer = "$($DatabaseServer)\$($DatabaseInstance)"
    }
    $connectionString = "Data Source=$DatabaseServer; Integrated Security=SSPI; Initial Catalog=$DatabaseName"

    write-Host -ForegroundColor Green "Invoke-SQL-SLOW with this statement on database '$DatabaseName':"
    Write-Host -ForegroundColor Gray $SQLCommand

    $connection = new-object system.data.SqlClient.SQLConnection($connectionString)
    

    $command = new-object system.data.sqlclient.sqlcommand($sqlCommand,$connection)
    $command.CommandTimeout =$TimeOut
    $connection.Open()

    $adapter = New-Object System.Data.sqlclient.sqlDataAdapter $command
    $dataset = New-Object System.Data.DataSet
    
    $adapter.Fill($dataSet) | Out-Null

    $connection.Close()
    $connection.Dispose()

    $dataSet.Tables

    }

Get-NAVCumulativeUpdateFile.ps1

Hi Waldo!

Well first of all thanks for all those scripts! I'm PS newbie so this helps a lot.

I do have an issue with the mentioned ps1 Script. It has (at least for me) an issue at the moment it tries to fetch all the version: 'Searching for list of updates'
It does not fail with the "List of hotfixed not found" Error. So I assume this part still worked but it seems to have problems to do this JSON Conversation and filling the $hotfixes parameter:

Cannot index into a null array.
At C:\Temp\Cloud.Ready.Software.PowerShell-master\PSModules\Cloud.Ready.Software.NAV\Upgrade\Get-NAVCumulativeUpdateFile.ps1:171 char:17
+                 $hotfixes = $matches.Groups[1].Value.Replace('\x','') | ConvertF ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : NullArray

Of course the rest of the script will fail.

So maybe I do something wrong here or MS has changed the Dataset for the array- Don't know.

Br
Kristof

Compile-NAVApplicationObjectInParallel does not work on local SQL named instance

Hi,

Compile-NAVApplicationObjectInParallel function does not work with named SQL, it returns a Server Not Found error. (I'm in 1.0.0.11 version I guess)

Call made to Get-NAVServerInstanceDetails is only used to retreive DatabaseName node value and so always call Compile-NAVApplicationObject function with DatabaseName only parameter, and then I suppose it only look for this database on 'Localhost' SQL server instance.

Regards

Use of Unapproved Verbs

Do you have plans to address this?

WARNING: The names of some imported commands from the module 'Cloud.Ready.Software.Windows' include unapproved verbs
that might make them less discoverable. To find the commands with unapproved verbs, run the Import-Module command again
with the Verbose parameter. For a list of approved verbs, type Get-Verb.

Get-NAVCumulativeUpdateFile and IE

I just noticed that Get-NAVCumulativeUpdateFile only works after you have run IE the first time so it has been setup. I just wanted to document it somewhere for later :-)

The error you get is
Searching for RSS item
_Invoke-WebRequest : The response content cannot be parsed because the Internet Explorer engine is not available, or Internet Explorer's
first-launch configuration is not complete. Specify the UseBasicParsing parameter and try again.
At C:\Users\soren\Source\Repos\Waldo\Cloud.Ready.Software.PowerShell\PSModules\Cloud.Ready.Software.NAV\Upgrade\Get-NAVCumulativeUpdateFile.ps1:47
char:23

  •     $feed = [xml](Invoke-WebRequest -Uri $feedurl)
    
  •                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : NotImplemented: (:) [Invoke-WebRequest], NotSupportedException
    • FullyQualifiedErrorId : WebCmdletIEDomNotSupportedException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand_

Backup-SQLDatabaseToFile Error Cannot find drive...

This command
Backup-SQLDatabaseToFile -DatabaseServer NAVDEV1 -DatabaseName "Demo Database NAV (11-0-21836 GB)"
Gives me the following error. Is there an assumption that I am issuing the command from a session on the SQL server machine? "G" (referenced below) is the drive where the SQL backups are put by default.

Join-Path : Cannot find drive. A drive with the name 'G' does not exist.
At C:\Program Files\WindowsPowerShell\Modules\Cloud.Ready.Software.SQL\1.0.1.7\Backup-SQLDatabaseToFile.ps1:51 char:27

  • $BackupFileFullPath = Join-Path $Backuplocation $BackupFile
    
  •                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : ObjectNotFound: (G:String) [Join-Path], DriveNotFoundException
    • FullyQualifiedErrorId : DriveNotFound,Microsoft.PowerShell.Commands.JoinPathCommand

Backing up database ...
BACKUP DATABASE [Demo Database NAV (11-0-21836 GB)] TO DISK = N'' WITH COPY_ONLY, NOFORMAT, INIT, NAME = N'NAVAPP_QA_MT-Full Database Backup', SKIP, NOREWIND, NOUNLOAD, STATS = 10
Invoke-Sqlcmd : Invalid zero-length device name. Reissue the BACKUP statement with a valid device name.
BACKUP DATABASE is terminating abnormally.
At C:\Program Files\WindowsPowerShell\Modules\Cloud.Ready.Software.SQL\1.0.1.7\Backup-SQLDatabaseToFile.ps1:57 char:5

  • Invoke-Sqlcmd -Query $SQLString -ServerInstance "$DatabaseServer\ ...
    
  • ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidOperation: (:) [Invoke-Sqlcmd], SqlPowerShellSqlExecutionException
    • FullyQualifiedErrorId : SqlError,Microsoft.SqlServer.Management.PowerShell.GetScriptCommand

Get-Item : Cannot bind argument to parameter 'Path' because it is null.
At C:\Program Files\WindowsPowerShell\Modules\Cloud.Ready.Software.SQL\1.0.1.7\Backup-SQLDatabaseToFile.ps1:59 char:14

  • Get-Item $BackupFileFullPath
    
  •          ~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidData: (:) [Get-Item], ParameterBindingValidationException
    • FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.GetItemCommand

Get-NAVCumulativeUpdateFile has issues with no CU web pages.

Hi @waldo1001, Microsoft have re-designed the cumulative update release pages, so the Get-NAVCumulativeUpdateFile function does not work. I will update the script in the next week or so and do a pull request. I don't know about anyone else but I still find this function useful, particularly for on-premise installations.

Merge-NAVVersionList sorts versions as text; fails when comparing e.g. '9.00' and '10.00'

Using the latest version of Merge-NAVVersionList from your GitHub repo, testing with the following data:

$MyVersionprefix = 'NAVW1', 'NAVBE', 'I'
$OrigVersionlist = 'NAVW19.10.00.37563,NAVBE7.10.00.37563'
$ModVersionList = 'NAVW19.10.00.37563,NAVBE7.10.00.37563,I7.4,M22344,M65877'
$TgtVersionList = 'NAVW110.00,NAVBE8.00'

Merge-NAVVersionList `
    -OriginalVersionList $OrigVersionlist `
    -ModifiedVersionList $ModVersionList `
    -TargetVersionList $TgtVersionList `
    -Versionprefix $MyVersionprefix

...will produce the following (incorrect, AFAIAC) result:

NAVW19.10.00.37563,NAVBE8.00,I7.4,M22344,M65877

Versions should probably not be sorted as simple text?!

Directory I/O Error from Import-NAVModules

Hi There, setting up a very new PC, and installing all my tools. While performing Import-NAVModules, I get a series of Folder errors like below.

PS C:\Windows\system32> Import-NAVModules
Get-NAVModuleVersions : Could not find a part of the path 'C:\Program Files\Microsoft Office\Updates\Download\PackageFiles\C1DAFD02-E2D1-4EB0-8326-DCE3C3FA8EF1\Data\Delt
a\root\vfs\Windows\assembly\GAC_MSIL\Microsoft.BusinessData\16.0.0.0__71E9BCE111E9429C\Microsoft.BusinessData.dll'.
At C:\Program Files\WindowsPowerShell\Modules\Cloud.Ready.Software.NAV\1.0.3.7\Import-NAVModules.ps1:62 char:31

  • ... Versions += Get-NAVModuleVersions 'Microsoft.Dynamics.Nav.Management. ...
  •             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : ReadError: (C:\Program File...usinessData.dll:String) [Write-Error], DirectoryNotFoundException
    • FullyQualifiedErrorId : DirIOError,Get-NAVModuleVersions

The extension script doesn't unpublish the extension

When you run "5_BuildAndDeployApp.ps1" in the extension scripts the old App is not unpublished. Now I am not sure if that is done intentional, but I would suggest we get that added.

Again this as much a reminder to my self to get his done as anything else :-)

We should add a script to open the web client instead of the windows client

Especially for App Development it would be handy that the web client came up when it is time to test. The windows client is kind of useless :) (Add tablet and phone client too for that matter)

I am just putting this one here as a place holder for my self or somebody else that is game for a little challenge.

Get-NAVCumulativeUpdateFile.ps1 fails on Windows Server 2016

I get the following error:

**_Cannot index into a null array.
At line:73 char:9

  •     $updateno = $titlematches.Groups[1]
    
  •     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidOperation: (:) [], RuntimeException
    • FullyQualifiedErrorId : NullArray_**

If I open Internet Explorer and include the "microsoft.com" website into the compatibility view list, then it works. It looks like Powershell can't access the DOM objects when IE opens the website in normal mode?

I can definitely live with this workaround, but I was wondering if I am missing something here.

Apply-NAVDelta

Change to be able to use without the NAVAdminTools .. . Only the model tools should be necessary.

Doing FullInstallNAV2018 installation and starting VS-Code Developing on W1 installation

This might be a little off topic, but because you provided this script I was asking myself if you have used this script combined with VS-Code with the AL-Extension and developed on a Navsion W1 2018 environment, all on a local-VM.
I'm kind of running against a brick wall when trying to get this answered on Microsoft/AL.

I't doesn't seem to work when using W1 Symbols an trying to publish an extension.
On Azure the W1 installation works, but I can't find a difference in configuration except for using Azure-SQL and using https.

Hopefully you can confirm that a full installed local environment with W1 is supported.

using "import-module sqlps" in several function

I see you use import-module sqlps in several module functions. Why is that?
Because now i'm kind of forced to only use sqlps instead of sqlserver, when using your modules
The sqlps module is kind of old, and the sqlserver module replaces this.
also sqlps can only be used if you have an sql-installation in place while sqlserver can be imported from psgallery. why not remove sqlps module from your functions and leave it up to the user to import sqlps or sqlserver.

Export-NAVALfromNAVApplicationObject - Finding the Error

When I run the Export-NAVALfromNAVApplicationObject command it works, creating the AL files for the exported object, reports "Errors: 0", but give this exception:

 cmd : 
 At C:\Program Files\WindowsPowerShell\Modules\Cloud.Ready.Software.NAV\1.0.3.7\ModelTools\Export-NAVALfromNAVApplicationObject.ps1:74 char:5
 +     cmd /c $Command
 +     ~~~~~~~~~~~~~~~
     + CategoryInfo          : NotSpecified: (:String) [], RemoteException
     + FullyQualifiedErrorId : NativeCommandError

Has anyone run into this before? If not how would I find what is causing this?

Here is the detailed output of the command:

PS >Export-NAVALfromNAVApplicationObject -ServerInstance BC140DEV -WorkingFolder ("E:\NAV\ExtensionsSupplemental\Customer" + $objtype + "s\Source") -TargetPath ("E:\NAV\ExtensionsSupplemental\Customer" + $objtype + "s\Converted" + $objid + $objname) -Filter "Type=$objtype;ID=$objid" -Verbose
VERBOSE: Searching in C:\Program Files (x86)\Microsoft Dynamics NAV, please wait a second...
VERBOSE: Searching in C:\Program Files\Microsoft Dynamics NAV, please wait a second...
VERBOSE: Searching in C:\Program Files (x86)\Microsoft Dynamics 365 Business Central, please wait a second...
VERBOSE: Searching in C:\Program Files\Microsoft Dynamics 365 Business Central, please wait a second...
VERBOSE: Searching in C:\Program Files (x86)\Microsoft Dynamics NAV, please wait a second...
VERBOSE: Searching in C:\Program Files\Microsoft Dynamics NAV, please wait a second...
VERBOSE: Searching in C:\Program Files (x86)\Microsoft Dynamics 365 Business Central, please wait a second...
VERBOSE: Searching in C:\Program Files\Microsoft Dynamics 365 Business Central, please wait a second...
VERBOSE: Searching in C:\Program Files (x86)\Microsoft Dynamics NAV, please wait a second...
VERBOSE: Searching in C:\Program Files\Microsoft Dynamics NAV, please wait a second...
VERBOSE: Searching in C:\Program Files (x86)\Microsoft Dynamics 365 Business Central, please wait a second...
VERBOSE: Searching in C:\Program Files\Microsoft Dynamics 365 Business Central, please wait a second...
VERBOSE: Searching in C:\Program Files (x86)\Microsoft Dynamics NAV, please wait a second...
VERBOSE: Searching in C:\Program Files\Microsoft Dynamics NAV, please wait a second...
VERBOSE: Searching in C:\Program Files (x86)\Microsoft Dynamics 365 Business Central, please wait a second...
VERBOSE: Searching in C:\Program Files\Microsoft Dynamics 365 Business Central, please wait a second...

Select NAV version you are going to use:

Index VersionNo NAV Apps Management NAV Apps Tools NAV Management NAV Model Tools


[1] 11.0.23572.0 True True True True
[2] 13.0.31719.0 True True True True
[3] 14.0.29530.0 True True True True

Please, select one of the options available: 3
VERBOSE: Importing cmdlet 'Convert-NAVCustomization'.
VERBOSE: Importing cmdlet 'Convert-NAVTenant'.
VERBOSE: Importing cmdlet 'Copy-NAVCompany'.
VERBOSE: Importing cmdlet 'Copy-NAVTenantData'.
VERBOSE: Importing cmdlet 'Dismount-NAVTenant'.
VERBOSE: Importing cmdlet 'Dismount-NAVTenantDatabase'.
VERBOSE: Importing cmdlet 'Export-NAVApplication'.
VERBOSE: Importing cmdlet 'Export-NAVData'.
VERBOSE: Importing cmdlet 'Export-NAVEncryptionKey'.
VERBOSE: Importing cmdlet 'Export-NAVServerLicenseInformation'.
VERBOSE: Importing cmdlet 'Get-NAVAddIn'.
VERBOSE: Importing cmdlet 'Get-NAVApplication'.
VERBOSE: Importing cmdlet 'Get-NAVCompany'.
VERBOSE: Importing cmdlet 'Get-NAVDataFile'.
VERBOSE: Importing cmdlet 'Get-NAVDataUpgrade'.
VERBOSE: Importing cmdlet 'Get-NAVServerAppConfiguration'.
VERBOSE: Importing cmdlet 'Get-NAVServerConfiguration'.
VERBOSE: Importing cmdlet 'Get-NAVServerInstance'.
VERBOSE: Importing cmdlet 'Get-NAVServerPermission'.
VERBOSE: Importing cmdlet 'Get-NAVServerPermissionSet'.
VERBOSE: Importing cmdlet 'Get-NAVServerSession'.
VERBOSE: Importing cmdlet 'Get-NAVServerUser'.
VERBOSE: Importing cmdlet 'Get-NAVServerUserPermissionSet'.
VERBOSE: Importing cmdlet 'Get-NAVTableConnection'.
VERBOSE: Importing cmdlet 'Get-NAVTenant'.
VERBOSE: Importing cmdlet 'Get-NAVTenantDatabase'.
VERBOSE: Importing cmdlet 'Get-NAVWebService'.
VERBOSE: Importing cmdlet 'Import-NAVConfigurationPackageFile'.
VERBOSE: Importing cmdlet 'Import-NAVData'.
VERBOSE: Importing cmdlet 'Import-NAVEncryptionKey'.
VERBOSE: Importing cmdlet 'Import-NAVMembershipEntitlement'.
VERBOSE: Importing cmdlet 'Import-NAVServerLicense'.
VERBOSE: Importing cmdlet 'Invoke-NAVCodeunit'.
VERBOSE: Importing cmdlet 'Mount-NAVApplication'.
VERBOSE: Importing cmdlet 'Mount-NAVTenant'.
VERBOSE: Importing cmdlet 'Mount-NAVTenantDatabase'.
VERBOSE: Importing cmdlet 'Move-NAVTenant'.
VERBOSE: Importing cmdlet 'New-NAVAddIn'.
VERBOSE: Importing cmdlet 'New-NAVCompany'.
VERBOSE: Importing cmdlet 'New-NAVDatabase'.
VERBOSE: Importing cmdlet 'New-NAVEncryptionKey'.
VERBOSE: Importing cmdlet 'New-NAVServerAppConfiguration'.
VERBOSE: Importing cmdlet 'New-NAVServerConfiguration'.
VERBOSE: Importing cmdlet 'New-NAVServerInstance'.
VERBOSE: Importing cmdlet 'New-NAVServerPermission'.
VERBOSE: Importing cmdlet 'New-NAVServerPermissionSet'.
VERBOSE: Importing cmdlet 'New-NAVServerUser'.
VERBOSE: Importing cmdlet 'New-NAVServerUserPermissionSet'.
VERBOSE: Importing cmdlet 'New-NAVTableConnection'.
VERBOSE: Importing cmdlet 'New-NAVTenant'.
VERBOSE: Importing cmdlet 'New-NAVWebService'.
VERBOSE: Importing cmdlet 'Register-NAVTenant'.
VERBOSE: Importing cmdlet 'Remove-NAVAddIn'.
VERBOSE: Importing cmdlet 'Remove-NAVApplication'.
VERBOSE: Importing cmdlet 'Remove-NAVCompany'.
VERBOSE: Importing cmdlet 'Remove-NAVConfigurationPackageFile'.
VERBOSE: Importing cmdlet 'Remove-NAVServerInstance'.
VERBOSE: Importing cmdlet 'Remove-NAVServerPermission'.
VERBOSE: Importing cmdlet 'Remove-NAVServerPermissionSet'.
VERBOSE: Importing cmdlet 'Remove-NAVServerSession'.
VERBOSE: Importing cmdlet 'Remove-NAVServerUser'.
VERBOSE: Importing cmdlet 'Remove-NAVServerUserPermissionSet'.
VERBOSE: Importing cmdlet 'Remove-NAVTableConnection'.
VERBOSE: Importing cmdlet 'Remove-NAVTenant'.
VERBOSE: Importing cmdlet 'Remove-NAVWebService'.
VERBOSE: Importing cmdlet 'Rename-NAVCompany'.
VERBOSE: Importing cmdlet 'Restart-NAVServerInstance'.
VERBOSE: Importing cmdlet 'Resume-NAVDataUpgrade'.
VERBOSE: Importing cmdlet 'Set-NAVAddIn'.
VERBOSE: Importing cmdlet 'Set-NAVApplication'.
VERBOSE: Importing cmdlet 'Set-NAVCompany'.
VERBOSE: Importing cmdlet 'Set-NAVServerAppConfiguration'.
VERBOSE: Importing cmdlet 'Set-NAVServerConfiguration'.
VERBOSE: Importing cmdlet 'Set-NAVServerInstance'.
VERBOSE: Importing cmdlet 'Set-NAVServerPermission'.
VERBOSE: Importing cmdlet 'Set-NAVServerPermissionSet'.
VERBOSE: Importing cmdlet 'Set-NAVServerUser'.
VERBOSE: Importing cmdlet 'Set-NAVTenant'.
VERBOSE: Importing cmdlet 'Start-NAVDataUpgrade'.
VERBOSE: Importing cmdlet 'Start-NAVServerInstance'.
VERBOSE: Importing cmdlet 'Stop-NAVDataUpgrade'.
VERBOSE: Importing cmdlet 'Stop-NAVServerInstance'.
VERBOSE: Importing cmdlet 'Sync-NAVTenant'.
VERBOSE: Importing cmdlet 'Sync-NAVTenantDatabase'.
VERBOSE: Importing cmdlet 'Test-NAVTenantDatabaseSchema'.
VERBOSE: Importing cmdlet 'Update-NAVScheduledTaskList'.
VERBOSE: Importing function 'Get-NAVWebServerInstance'.
VERBOSE: Importing function 'Get-NAVWebServerInstanceConfiguration'.
VERBOSE: Importing function 'New-NAVWebServerInstance'.
VERBOSE: Importing function 'Remove-NAVWebServerInstance'.
VERBOSE: Importing function 'Set-NAVWebServerInstanceConfiguration'.
VERBOSE: NAV Management module has been imported
VERBOSE: Loading module from path 'C:\Program Files (x86)\Microsoft Dynamics 365 Business Central\140\RoleTailored Client\Microsoft.Dynamics.Nav.Model.Tools.psd1'.
VERBOSE: Importing cmdlet 'Compare-NAVApplicationObject'.
VERBOSE: Importing cmdlet 'Export-NAVApplicationObjectLanguage'.
VERBOSE: Importing cmdlet 'Get-NAVApplicationObjectProperty'.
VERBOSE: Importing cmdlet 'Import-NAVApplicationObjectLanguage'.
VERBOSE: Importing cmdlet 'Join-NAVApplicationObjectFile'.
VERBOSE: Importing cmdlet 'Join-NAVApplicationObjectLanguageFile'.
VERBOSE: Importing cmdlet 'Merge-NAVApplicationObject'.
VERBOSE: Importing cmdlet 'Remove-NAVApplicationObjectLanguage'.
VERBOSE: Importing cmdlet 'Set-NAVApplicationObjectProperty'.
VERBOSE: Importing cmdlet 'Split-NAVApplicationObjectFile'.
VERBOSE: Importing cmdlet 'Split-NAVApplicationObjectLanguageFile'.
VERBOSE: Importing cmdlet 'Test-NAVApplicationObjectLanguage'.
VERBOSE: Importing cmdlet 'Test-NAVApplicationTable'.
VERBOSE: Importing cmdlet 'Update-NAVApplicationObject'.
VERBOSE: The 'Compile-NAVApplicationObject' command in the Microsoft.Dynamics.Nav.Model.Tools' module was imported, but because its name does not include an approved verb, it might be difficult to find. For a list of approved verbs, type Get-Verb
.
VERBOSE: Importing function 'Compile-NAVApplicationObject'.
VERBOSE: The 'Create-NAVDatabase' command in the Microsoft.Dynamics.Nav.Model.Tools' module was imported, but because its name does not include an approved verb, it might be difficult to find. The suggested alternative verbs are "New".
VERBOSE: Importing function 'Create-NAVDatabase'.
VERBOSE: The 'Delete-NAVApplicationObject' command in the Microsoft.Dynamics.Nav.Model.Tools' module was imported, but because its name does not include an approved verb, it might be difficult to find. The suggested alternative verbs are "Remove"
.
VERBOSE: Importing function 'Delete-NAVApplicationObject'.
VERBOSE: Importing function 'Export-NAVApplicationObject'.
VERBOSE: Importing function 'Import-NAVApplicationObject'.
VERBOSE: Importing function 'Invoke-NAVDatabaseConversion'.
VERBOSE: Importing variable 'NavClientPath'.
VERBOSE: Importing variable 'NavIde'.
VERBOSE: NAV Model Tools module has been imported
VERBOSE: Loading module from path 'C:\Program Files (x86)\Microsoft Dynamics 365 Business Central\140\RoleTailored Client\Microsoft.Dynamics.Nav.Apps.Tools.psd1'.
VERBOSE: Importing cmdlet 'Compare-NAVAppApplicationObjectLanguage'.
VERBOSE: Importing cmdlet 'Export-NAVAppPermissionSet'.
VERBOSE: Importing cmdlet 'Export-NAVAppReportLayout'.
VERBOSE: Importing cmdlet 'Export-NAVAppTableData'.
VERBOSE: Importing cmdlet 'Export-NAVAppTenantWebService'.
VERBOSE: NAV Apps Tools module has been imported
VERBOSE: Loading module from path 'C:\Program Files (x86)\Microsoft Dynamics 365 Business Central\140\RoleTailored Client\Microsoft.Dynamics.Nav.Apps.Management.psd1'.
VERBOSE: Importing cmdlet 'Get-NAVAppInfo'.
VERBOSE: Importing cmdlet 'Get-NavAppRuntimePackage'.
VERBOSE: Importing cmdlet 'Get-NAVAppTableModification'.
VERBOSE: Importing cmdlet 'Get-NAVAppTenant'.
VERBOSE: Importing cmdlet 'Install-NAVApp'.
VERBOSE: Importing cmdlet 'Publish-NAVApp'.
VERBOSE: Importing cmdlet 'Repair-NAVApp'.
VERBOSE: Importing cmdlet 'Start-NAVAppDataUpgrade'.
VERBOSE: Importing cmdlet 'Sync-NAVApp'.
VERBOSE: Importing cmdlet 'Uninstall-NAVApp'.
VERBOSE: Importing cmdlet 'Unpublish-NAVApp'.
VERBOSE: NAV Apps Management module has been imported
VERBOSE: WriteObjectServerCommand.InternalProcessRecord
VERBOSE: WriteObjectServerCommand.InternalWriteObject(object)
Export Objects with:
"C:\Program Files (x86)\Microsoft Dynamics 365 Business Central\140\RoleTailored Client\finsql.exe" command=ExportToNewSyntax,file=E:\NAV\ExtensionsSupplemental\Customer\Reports\Source\ExportFile.txt,servername="LOCALHOST",database="JF140000-Tes
t",Logfile=E:\NAV\ExtensionsSupplemental\Customer\Reports\Source\Log_ExportFile.txt,filter=Type=Report;ID=23019012
[0] [20191113D 171627.860T] The command completed successfully in '0' seconds.
Splitting objects to E:\NAV\ExtensionsSupplemental\Customer\Reports\Source\Split
Convert objects with:
"C:\Program Files (x86)\Microsoft Dynamics 365 Business Central\140\RoleTailored Client\txt2al.exe" --source="E:\NAV\ExtensionsSupplemental\Customer\Reports\Source\Split" --target="E:\NAV\ExtensionsSupplemental\Customer\Reports\Converted\23019012
SalesInvoiceWord" --rename --extensionStartId=70000000
Writing: E:\NAV\ExtensionsSupplemental\Customer\Reports\Converted\23019012SalesInvoiceWord\Report 23019012 - Sales - Invoice (Word).al
Writing: E:\NAV\ExtensionsSupplemental\Customer\Reports\Converted\23019012SalesInvoiceWord\Sales - Invoice (Word).rdlc
Writing: E:\NAV\ExtensionsSupplemental\Customer\Reports\Converted\23019012SalesInvoiceWord\Sales - Invoice (Word).docx
cmd :
At C:\Program Files\WindowsPowerShell\Modules\Cloud.Ready.Software.NAV\1.0.3.7\ModelTools\Export-NAVALfromNAVApplicationObject.ps1:74 char:5

  • cmd /c $Command
    
  • ~~~~~~~~~~~~~~~
    
    • CategoryInfo : NotSpecified: (:String) [], RemoteException
    • FullyQualifiedErrorId : NativeCommandError

Total Time: 0:00:00.5257474
Errors: 0

Unlock-NAVApplicationObjects

Seems that this function ( NAV2016) version has reversed the check for the Database Instance:

version I have reads:
if ([string]::IsNullOrEmpty($ServerInstanceObject.DatabaseInstance)){
$DatabaseServer = $ServerInstanceObject.DatabaseServer + "" + $ServerInstanceObject.DatabaseInstance
} Else {
$DatabaseServer = $ServerInstanceObject.DatabaseServer

}

I think it should be :
if ([string]::IsNullOrEmpty($ServerInstanceObject.DatabaseInstance)){
$DatabaseServer = $ServerInstanceObject.DatabaseServer
} Else {
$DatabaseServer = $ServerInstanceObject.DatabaseServer + "" + $ServerInstanceObject.DatabaseInstance

}

I am not familiar to git so please explain me if I need to report this in another way.

New-NAVEnvironment do not close SQL connection ?

Hi,

I'm not sure but it seems New-NAVEnvironment function does not close opened SQL connections once execution is done.
For example I tried to create a script by using this function followed by invoking database conversion and synch tables (newer build on development environment), but an error about non exclusive connection is always raised.
Closing and reopen PS ISE to launch again only convertion and Synch works fine.

Possible issues related to the new functions added in #32

Hi,
I cannot see the new functions added in #32 to be present in the "Cloud.Ready.Software.NAV.psd1". Is it OK? It seems to be working generally well but I am working on some improvements (version discovery using background jobs to speed up the whole process) and those are failing just because the new functions "doesn`t exist".

Import specified version of NAV modules

It would be great if you where able to import a specified version of the NAV modules with Import-NAVModules e.g.

Import-NAVModules -navVersion 10

would import whatever version of NAV 2017 you have installed.

At the moment it seems the parameter is not used for anything.

New option for Get-NAVCumulativeUpdateFile

Idea to add a CU option for this script so it takes a specific CU and not only the latest. If left blank just download the latest. Again just an idea that would make this much more useful for the majority of developers that are not on the latest version ...

Delete-NAVApplicationObject

Comment on from Aize Schuurmans:

When removing the Delta I get an error when trying to delete objects.

I think this is because the Delete-NAVApplicationObject2 script doesn't take the SQL Server instance into account, but only works on the default SQL server instance.

My test database is on the servername\NAVDEMO instance and deleting the objects results in the error:
"Delete-NAVApplicationObject : : [22924072] The servername server cannot be found."

Maybe an optimisation for the next release of the Tools?

Import-NAVModules does not import from BC modules

It doesn´t seems like Import-Navmodules looks for BC on prem folder Microsoft switch name
from
Microsoft Dynamics NAV
to
Microsoft Dynamics 365 Business Central

Please update Get-NAVModuleVersions.ps1 to support this

Suggestion for Get-NAVCumulativeUpdateFile.ps1

I suggest that it's documented that you can use lots of other RSS URLs in the Get-NAVCumulativeUpdateFile.ps1 script.

This allows the script to download any of the NAV versions, except 2013r2 CU1..5.


                Write-Host -Object "Processing parameters $CountryCode $version $CUNo" -ForegroundColor Cyan

                $feedurl = 'https://blogs.msdn.microsoft.com/nav/tag/nav-2013/feed/'
                $feedurl = 'https://blogs.msdn.microsoft.com/nav/tag/nav-2013-r2/feed/'
                $feedurl = 'https://blogs.msdn.microsoft.com/nav/tag/nav-2015/feed/'
                $feedurl = 'https://blogs.msdn.microsoft.com/nav/tag/nav-2016/feed/'
                $feedurl = 'https://blogs.msdn.microsoft.com/nav/2014/4/feed/'
                $feedurl = 'https://blogs.msdn.microsoft.com/nav/2015/5/11/feed/'

                $feedurl = 'https://blogs.msdn.microsoft.com/nav/category/announcements/cu/feed/'

Perhaps even a command line option ?

Get-NAVCumulativeUpdateFile: cannot extract build version

Using the script to download the newest Cumulative Update, but it cannot extract the build version:

{
    "NAVVersion":  "2018",
    "CountryCode":  "DE",
    "CUNo":  "06",
    "Build":  "UnknownBuildNo",
    "KBUrl":  "http://support.microsoft.com/help/4337675",
    "ProductID":  "56981"
}

Can not load modules


Windows PowerShell ISE - Error

Failed to import the module required by command "Backup-NAVDatabase". Module name: "Cloud.Ready.Software.NAV". Error message: "Unable to find type [Microsoft.Dynamics.Nav.Model.Tools.ApplicationObjectFileInfo].".

OK

I'am gettin this error when i try to Load modules or Refresh in PowerShell ISE.

A commandlet for identifying Variable ID conflicts on the merge process?

Hello, i am getting so much variable conflicts during merges. The bad thing about this is, the conflicts being problem on the Import process. For example, when the first conflict is on %85 then i am getting the error after 15 min import process. I resolve the issue, then import again. If there is another conflict ie %88, then i have to import whole objects again in order to see another conflict. It is very time consuming process and very unproductive way to resolve a simple problem.

I wonder is there a way to identfy those conflicts before import the merged object file ?

New-NAVEnvironment

Just trying to run New-NAVEnvironment with "my scripts" with the new NAV 2017 RTM.

Restoring database NAV100_NA_RTM
RESTORE DATABASE [NAV100_NA_RTM] FROM DISK = N'C:\Core\Backup\NA.BAK' WITH FILE = 1,
MOVE N'Demo Database NAV (10-0)_Data' TO N'C:\Program Files\Microsoft SQL Server\MSSQL12.NAVDEMO\MSSQL\DATA\NAV100_NA_RTM_1.mdf',
MOVE N'Demo Database NAV (10-0)_Log' TO N'C:\Program Files\Microsoft SQL Server\MSSQL12.NAVDEMO\MSSQL\DATA\NAV100_NA_RTM_2.ldf',
NOUNLOAD, REPLACE, STATS = 5
Invoke-Sqlcmd : Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
Converting database 'NAV100_NA_RTM' from version 706 to the current version 782.
At C:\Users\epernst\Documents\Cloud.Ready.Software.PowerShell\PSModules\Cloud.Ready.Software.SQL\Restore-SQLBackupFile.ps1:60 char:13

  • $null = Invoke-Sqlcmd -Query $RestoreSQLString -ServerInstance "$DatabaseSer ...
    
  • - CategoryInfo          : InvalidOperation: (:) [Invoke-Sqlcmd], SqlPowerShellSqlExecutionException
    - FullyQualifiedErrorId : SqlError,Microsoft.SqlServer.Management.PowerShell.GetScriptCommand
    
    

Figuring that it's trying to upgrade the SQL version and that's what failing. Then I went into SQL, manually upgrade the version from 110 to 120 and created a new *.BAK file - instead of the one supplied by Microsoft on the DVD that I used before.
Running it with the new backup already in version 120 allows me to run the function again.

But exactly what was changed here? In NAV 2017 Limited Beta the bak files supplied were also version 110, but here it worked fine.

Environment variable name or value is too long

Remove-NAVServerInstance : Environment variable name or value is too long.
At C:\GitHub\Cloud.Ready.Software.PowerShell\PSModules\Cloud.Ready.Software.NAV\Remove-NAVEnvironment.ps1:48 char:9

I'm encountering errors like the above when working with the New-NAVEnvironment and Remove-NAVEnvironment. My suspicion is that this is something to do with having imported the SQLPS module - but I haven't been able to confirm that yet.

I'll keep investigating but wondered if anyone else had come across this error before - Googling doesn't seem to turn up a great deal.

How about a README.md in each of the (module) folders?

How about a README.md in each of the (module) folders explaining what the scripts in that folder do? The structure may seem logical and clear to you (since you created it - over time), but the amount of information and scripts here can be quite overwhelming to the casual visitor... ;-)

Even beter: put all documentation into your cmdlets as comment-based help (so that it can also be consulted within PowerShell), then use Get-Help to extract the information and somehow ~magically convert that to MarkDown, ready for publication on GitHub?! :-)

Thanks for considering my suggestion!

Create-NAVDelta.ps1 doesnt support new parameter -ExportToNewSyntax

Create-NAVDelta.ps1 doesn't use/support new parameter -ExportToNewSyntax in function:Compare-NAVApplicationObject.
This parameter -ExportToNewSyntax is needed otherwise the txt2al.exe conversion will raise an error for the page extensions.

example of this error
----ERROR----
Error converting file:C:\Merge\testAL8\Create-NAVDelta\AppFiles_NewSyntax\PAG30.DELTA
The delta file was not generated with ExportToNewSyntax flag
----ERROR----

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.