Cmdlet not recognized

Hello everyone,

I have a strange issue with PowerShell and the AIP module (Azure Information Protection), and I don’t find the solution.

I have a service account that I use to encrypt documents on the fly that are uploaded to an FTP server installed on Windows.

For this I use a token created on Azure which allows not to authenticate each time I launch the script.

The scenario is as follows:

  • The service for FTP is launched with the service account
  • A user uploads a file to the FTP
  • The FTP server automatically launches a script and encrypts the document

This method works for two servers, so I can validate that my script works perfectly. However, for another server, I get this error:

Get-AIPFileStatus: The term ‘Get-AIPFileStatus’ is not recognized as the name of a cmdlet, function, script file, or
operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try
again.

However, when I start the script manually with this account, I have no problem. The error only occurs when the script is automatically launched by the FTP server.

I cannot understand why it does not recognize the command when it is clearly installed via the AIP module.

Someone have a miracle solution please ?

Thanks in advance.

Sounds like you need to import the module in your script. If it’s already installed on the machine where the ftp script is running, just add import-module AIP near the beginning of the script to make those commands available. You could also use session configuration or profiles.

Hello Doug,

I’ve already added this in the begining of my script with no result… Always the same issue.

Can you verify the module was imported? You might have to do run Install-Module AIP

Hello Amar,

This module is automatically installed with the package Azure Information Protection :
https://www.microsoft.com/en-us/download/details.aspx?id=53018

I also installed these modules :

  • Install-Module -Name AIPService
  • Install-Module -Name AzureADPreview
I really insist that the script works perfectly when launched manually. The error only comes from when it is launched via the FTP server.

Hello,

I resolved my issue with the full path in my Import-Module command.

Import-Module “C:\Program Files (x86)\Microsoft Azure Information Protection\Powershell\AzureInformationProtection” -Force

Thanks.