question

Neil676-4734 avatar image
0 Votes"
Neil676-4734 asked ·

Autospinstaller - Visio - Cmdlets not recognised.

After bringing the Visio Service Instance online, the AutoSPInstallerModule.psm1 script around line 2406 - Re-importing SP Powershell Snapin to enable new cmdlets... attempts to remove "Microsoft.SharePoint.PowerShell" snap in and subsequently re-add via the Add-SharePointPSSnapin function. This returns no errors.

Following this in the script an Invoke expression attempts to use Get-SPVisioServiceApplication (via a variable). At this point I receive an error stating that the cmdlet is not available.

Once the script completes, if I run Get-SPVisioServiceApplication it states it is not available. If I then run Add-PSSnapin Microsoft.SharePoint.Powershell, Get-SPVisioServiceApplication is then available. If I run the script a second time it completes without issue. I have also hard coded the Add-PSSnapin Microsoft.SharePoint.PowerShell command directly before the invoke expression to no avail.

Has anyone else experienced this or can offer any advice?

windows-server-powershelloffice-sharepoint-server-administrationoffice-sharepoint-server-development
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

MichaelHan-MSFT avatar image
0 Votes"
MichaelHan-MSFT answered ·

Hello @Neil676-4734 ,

Before the invoke expression, you could try to use Remove-PSSnapin Microsoft.SharePoint.PowerShell cmdlet to unload the Microsoft.SharePoint.PowerShell and then reload it using Add-PSSnapin Microsoft.SharePoint.PowerShell. Check if it works for you.


If an Answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


· 3 ·
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thanks for the reply, unfortunately I have already tried this.

0 Votes 0 ·

Hello @Neil676-4734 ,

This could be that the Visio Services application is not created that time, so you receive the error. After creating the SPVisioServiceApplication, you could use Get-SPVisioServiceApplication cmdlet.

You could add the invoke expression in the function CreateVisioServiceApp. It may work for you.


0 Votes 0 ·

The Visio service instances have been started at this point. If I force exit the script at the time of failure and then immediately add the Microsoft.SharePoint.PowerShell snapin, this causes the Get-SPVisioServiceApplication to work. Its the CreateGenericServiceApplication function that enables the Visio instances and the Invoke-expression line that immediately fails afterwards in this function. I am not sure how moving this line to the CreateVisioServiceApp function would help.

0 Votes 0 ·