Run escalated PowerShell script from a batch file

PowerShellI posted a Power Shell snippet a while ago on bypassing the execution policy. More recently I needed to combine that with running a script with administrator permissions. I did a little exploring and found an article by Adam Dimech which contained this code which can be run from a batch file:

Change the highlighted section to your saved ps1 file and you can run that script escalated with administrator permissions.

PowerShell  -NoProfile -ExecutionPolicy Bypass -Command "& {Start-Process PowerShell -ArgumentList '-NoProfile -ExecutionPolicy Bypass -File ""{path and filename of ps1 file}""' -Verb RunAs}"

Stored procedure to get next Dynamics GP Payables Voucher Number

Microsoft Dynamics GPI’ve previously posted SQL stored procedures to get the next GL Journal Number and the next PO Receipt number and today it is the turn of a stored procedure to get the next PM Voucher Number.

The stored procedure will call the eConnect stored procedure which gets the next number and increments the stored value. This code was written so I could easily call it from VBA in Integration Manager for an integration which needed to insert some data into a custom table. This allowed me to get the voucher number up front and use it in the VBA.

-- drop stored proc if it exists
IF OBJECT_ID(N'usp_AZRCRV_GetNextPMVoucherNumber', N'P') IS NOT NULL
    DROP PROCEDURE usp_AZRCRV_GetNextPMVoucherNumber
GO
-- create stored proc
CREATE PROCEDURE usp_AZRCRV_GetNextPMVoucherNumber AS
/*
Created by Ian Grieve of azurecurve|Ramblings of a Dynamics GP Consultant (https://www.azurecurve.co.uk)
This code is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 2.0 UK: England & Wales (CC BY-NC-SA 2.0 UK).
*/
BEGIN
	DECLARE @return_value AS INT
	DECLARE @O_vCNTRLNUM AS VARCHAR(17)
	DECLARE @I_sCNTRLTYP AS TINYINT = 0
	DECLARE @O_iErrorState AS INT

	EXEC @return_value = taGetPMNextVoucherNumber
				@I_sCNTRLTYP = @I_sCNTRLTYP
				,@O_iErrorState = @O_iErrorState OUTPUT
				,@O_vCNTRLNUM = @O_vCNTRLNUM OUTPUT
	SELECT @O_vCNTRLNUM AS VCHRNMBR
END
GO

-- grant execute permission on stored proc to DYNGRP
GRANT EXECUTE ON usp_AZRCRV_GetNextPMVoucherNumber TO DYNGRP
GO

The stored procedure can be executed using this command:

-- execute stored proc
EXEC usp_AZRCRV_GetNextPMVoucherNumber
GO

ClassicPress Development with GitHub: Commit Files

GitHubWhen I started developing plugins for ClassicPress I decided that I needed to be using source control. As ClassicPress is intending to use GitHub for their plugin directory, it made sense for me to use it as well. This post is part of a series on ClassicPress Development with GitHub.

With a repository created, we can now upload the existing project files. Do this by visiting the repository page and click the Upload files button:

GitHub repository page

Continue reading “ClassicPress Development with GitHub: Commit Files”

ClassicPress Development with GitHub: Create Repository

GitHubWhen I started developing plugins for ClassicPress I decided that I needed to be using source control. As ClassicPress is intending to use GitHub for their plugin directory, it made sense for me to use it as well. This post is part of a series on ClassicPress Development with GitHub.

With us now signed up for GitHub, we can create our first repository. From your dashboard (which is https://github.com/ followed by your username), click the New repository button:

Create a new repository on GitHub

Continue reading “ClassicPress Development with GitHub: Create Repository”

azurecurve ClassicPress Plugins: All plugins now auto-update

ClassicPress PluginsThis is part of the azurecurve ClassicPress Plugins which introduces the plugins I have available for ClassicPress.

I have 35 plugins now published for ClassicPress which have required a manual update whenever I released a new version. Well, CodePotent has developed an Update Manager plugin which can be used to automatically update plugins.

This has been integrated into the latest version of all of my plugins; this means if you manually update to the latest version, all future updates will come down as an automatic update which is applied in the same way as the WordPress plugin updates.

It’s been pointed out to me that I should clarify that by “automatic update” I mean it is available as an update in the same way as a standard plugin updated from the WordPress Repository, and in future from the ClassicPress Directory, not that it will update without an admin logging into the dashboard and hitting the update button.

All future plugins I create will include this automatic update functionality as well, until such time as the ClassicPress Plugin Directory is launched.

Click to show/hide the azurecurve ClassicPress Plugins Series Index

Updated at 2128 on 31/01/2020 to clarify what I mean by auto-update.

Dynamics GP Reconcile to GL missing the option for Inventory

Microsoft Dynamics GPI helped field a query from a client recently on the Reconcile to GL routine (Financial » Routines » Reconcile to GL) showing Payables Management, Receivales Management and Bank Reconciliation, but not Inventory.

This client has been a long time user of Microsoft Dynamics GP who had recently upgraded. This issue is a known one, addressed on the Dynamics GP Support and Services Blog.

With the support of the helpdesk, the client was able to run through the steps to resolve the issue and perform a reconciliation of the Inventory module to the GL.

azurecurve ClassicPress Plugins: To Twitter

ClassicPress PluginsThis is part of the azurecurve ClassicPress Plugins which introduces the plugins I have available for ClassicPress.

The plugin I am going to cover in this post, is a brand new one written for ClassicPress; To Twitter.

Functionality

Allows posts to be automatically tweeted when they are published.

Mark the Post tweet on publish/update? checkbox to post tweet when the post is published (works for both immediately and scheduled posts.

Set hashtags in the hashtags box; these appear after the tweet.

Save a draft of the post to see auto-generated default tweet and amend if necessary; to regenerate default tweet, clear Tweet field and save draft; post URL is represented by a %s placeholder.

Integrates with my URL Shortener for URL in tweet.

This plugin is multisite compatible with each site having it’s own settings.

Download

The plugin can be downloaded via my Development site.

Click to show/hide the azurecurve ClassicPress Plugins Series Index

Wildcard character in Dynamics GP Workflow conditions

Microsoft Dynamics GPI’ve done a lot of work with the Microsoft Dynamics GP Workflow module over the years since it was first released and it still seems to be growing in popularity with clients. Depending on the workflow type being created, the GL account string can be used in conditions to determine the routing for the approver.

However, commonly clients want to check the value for a single segment rather than the full account string. You can, to an extend, accomplish this using filters such as contains or begins with, but sometimes this isn’t feasible. You can get round this problem be using the _ wildcard in your condition.

For example, if I was setting up a purchase requisition workflow and wanted to configure a routing for all advertising expense codes, which is the codes where the Account segment start 66, to the Marketing Director, I could set up a condition where the account string is ___-66_0-00:

Workflow Condition error with wildcards in the account string

Workflow Condition example with wildcards in the account string

This would use this workflow step for all Divisions (segment 1) for department 00, where the Account (segment 2) starts with 66 and ends with 0. The wildcard character allows an account string with any value in the characters replaced with an underscore to be selected.

azurecurve ClassicPress Plugins: Markdown

ClassicPress PluginsThis is part of the azurecurve ClassicPress Plugins which introduces the plugins I have available for ClassicPress.

The plugin I am going to cover in this post, is a brand new one written for ClassicPress; Markdown.

Functionality

This plugin allows a [markdown]shortcode[/markdown] to be applied which will translate markdown into HTML markup for display.

Demo

Markdown is installed on my Development site with all of the plugin pages, including the one for this plugin are written in markdown.

Download

The plugin can be downloaded via my Development site.

Click to show/hide the azurecurve ClassicPress Plugins Series Index

“The vendor has an existing purchase order…” error message when using Integration Manager

Microsoft Dynamics GPI’ve recently been working with a client to implement Microsoft Dynamics GP and have been using Integration Manager to import the opening data. While importing payables transactions I encountered the following error:

The vendor has an existing purchase order error

The vendor has an existing purchase order. Choose Continue to post or save. Choose Go To to view a purchasing navigation list. Choose Cancel to return to the window...

Continue reading ““The vendor has an existing purchase order…” error message when using Integration Manager”