Please follow the following steps in an EMPTY environment!
Create the following folder structure in the Scripts overview.
Repository
-- Scripts
--- Microsoft
---- Active Directory
----- Users
----- Computers
Set the Script Base Folder to "Scripts"
Add a new script to the folder "Scripts\Microsoft\Active Directory\Users" and save it.
In scripts.ps1 the following line is added:
New-PSUScript -Name "Get AD User.ps1" -Description "Get AD User" -Path "Microsoft\Active Directory\Users\Get AD User.ps1" -Environment "Windows PowerShell 7.4" -InformationAction "SilentlyContinue"
Move the newly created script to folder "Scripts\Microsoft\Active Directory\Computers" and save it.
Issue 1: In the admin console browse to the folder Scripts\Microsoft\Active Directory\Computers. As you can see, the script isn't there.
In scripts.ps1, the following line is present:
New-PSUScript -Name "Get AD User.ps1" -Description "Get AD User" -Path "**<PATH_TO_REPO_DEFINED_IN_APPSETTINGS>\Repository\**Microsoft\Active Directory\Computers\Get AD User.ps1" -Environment "Windows PowerShell 7.4" -InformationAction "SilentlyContinue"
In the background when moving a script, following is happened:
The following folder structure "Microsoft\Active Directory\Computers" is created in the root of Repository folder.
Script is moved to "Repository\Microsoft\Active Directory\Computers".
In the scripts.PS1 the whole path is used "\Repository\Microsoft\Active Directory\Computers" instead of "Microsoft\Active Directory\Computers".
Add a new script, in a random folder and save it.
Issue 2: Open script.ps1 file, as you can see, the previously created script is gone.
When adding a new script, the previously created script reference is deleted, since PowerShell Universal can't find a script is the desired folder.
The following error is shown in the notification area;
Cannot process argument because the value of argument "path" is null. Change the value of argument "path" to a non-null value.
Root Cause
I think the root cause is a invalid fullpath property in the body while calling the PUT /scripts API endpoint:
Version
4.2.11
Severity
Critical
Steps to Reproduce
Please follow the following steps in an EMPTY environment!
Create the following folder structure in the Scripts overview.
Set the Script Base Folder to "Scripts"
Add a new script to the folder "Scripts\Microsoft\Active Directory\Users" and save it.
In scripts.ps1 the following line is added:
New-PSUScript -Name "Get AD User.ps1" -Description "Get AD User" -Path "Microsoft\Active Directory\Users\Get AD User.ps1" -Environment "Windows PowerShell 7.4" -InformationAction "SilentlyContinue"
Move the newly created script to folder "Scripts\Microsoft\Active Directory\Computers" and save it.
Issue 1: In the admin console browse to the folder Scripts\Microsoft\Active Directory\Computers. As you can see, the script isn't there.
In scripts.ps1, the following line is present:
New-PSUScript -Name "Get AD User.ps1" -Description "Get AD User" -Path "**<PATH_TO_REPO_DEFINED_IN_APPSETTINGS>\Repository\**Microsoft\Active Directory\Computers\Get AD User.ps1" -Environment "Windows PowerShell 7.4" -InformationAction "SilentlyContinue"
In the background when moving a script, following is happened:
Add a new script, in a random folder and save it.
Issue 2: Open script.ps1 file, as you can see, the previously created script is gone.
When adding a new script, the previously created script reference is deleted, since PowerShell Universal can't find a script is the desired folder.
The following error is shown in the notification area; Cannot process argument because the value of argument "path" is null. Change the value of argument "path" to a non-null value.
Root Cause
I think the root cause is a invalid fullpath property in the body while calling the PUT /scripts API endpoint:
As you can see, between "Repository" and "Microsoft" there is a gap. Between these folders, the Script Base Folder value should be stored.
Expected behavior
Actual behavior
Additional Environment data
No response
Visuals
No response