LuminarLeaf / Expeditions-Mod-Installer

Install mods for "Expeditions: A Mudrunner Game" from Mod.io
GNU Affero General Public License v3.0
5 stars 1 forks source link

Get-Content : Access to the path is denied, ModIO_EXP.ps1:87 char:20 #2

Closed Gaemghost20000 closed 8 months ago

Gaemghost20000 commented 8 months ago

Hi Team, @AryanVerma1024 I have been experiencing the following errors when trying to run the script.

PS D:\Games\Expeditions - A MudRunner Game\Expeditions-Mod-Installer-main> .\ModIO_EXP.ps1
.\ModIO_EXP.ps1 : File D:\Games\Expeditions - A MudRunner Game\Expeditions-Mod-Installer-main\ModIO_EXP.ps1 cannot be
loaded because running scripts is disabled on this system. For more information, see about_Execution_Policies at
https:/go.microsoft.com/fwlink/?LinkID=135170.
At line:1 char:1
+ .\ModIO_EXP.ps1
+ ~~~~~~~~~~~~~~~
    + CategoryInfo          : SecurityError: (:) [], PSSecurityException
    + FullyQualifiedErrorId : UnauthorizedAccess
PS D:\Games\Expeditions - A MudRunner Game\Expeditions-Mod-Installer-main> Set-ExecutionPolicy -ExecutionPolicy bypass
PS D:\Games\Expeditions - A MudRunner Game\Expeditions-Mod-Installer-main> .\ModIO_EXP.ps1
Get-Content : Access to the path 'C:\Users\gaemz\Documents\My Games\Expeditions\base\Mods\.modio\mods' is denied.
At D:\Games\Expeditions - A MudRunner Game\Expeditions-Mod-Installer-main\ModIO_EXP.ps1:87 char:20
+ $UserProfileJson = Get-Content $env:USER_PROFILE
+                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : PermissionDenied: (C:\Users\gaemz\...ods\.modio\mods:String) [Get-Content], Unauthorized
   AccessException
    + FullyQualifiedErrorId : GetContentReaderUnauthorizedAccessError,Microsoft.PowerShell.Commands.GetContentCommand

Cannot index into a null array.
At D:\Games\Expeditions - A MudRunner Game\Expeditions-Mod-Installer-main\ModIO_EXP.ps1:89 char:8
+ while ($UserProfileJson[-1] -ne "}") {
+        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : NullArray

ERROR: UserProfile is not valid
PS D:\Games\Expeditions - A MudRunner Game\Expeditions-Mod-Installer-main>

System Details are the following

Device name Gaem4090 Processor AMD Ryzen 7 5800X 8-Core Processor 3.80 GHz Installed RAM 80.0 GB Edition Windows 11 Pro for Workstations Version 23H2 Installed on ‎23/‎02/‎2024 OS build 22631.3235 Experience Windows Feature Experience Pack 1000.22687.1000.0 Game Version is FitGirl RUNE Repack based on Expeditions.A.MudRunner.Game-RUNE ISO release: rune-expeditions.a.mudrunner.game.iso (15,987,245,056 bytes) Expeditions-Mod-Installer started with the commit cd8a0d4, and also tried commit 3798193

Troubleshooting

well first I noticed that the command windows would pop up for a split second before closing so I opened both CMD/PS shell and the new windows terminal. all with and without admin.

attached image of error messages in Admin Terminal PS, image_2024-03-06_234709418

I first encounter the "Execution_Policies" error which I seem to be able to work around by setting the policy to bypass. by default everything was set to Undefined, Info found here

I tried changing .env:USER_PROFILE to other locations. including a newly created folder near the root of D:\ (D:\Games\ModIO) and inside of the Mod-Installers folders with no change to the access denied message apart from the path that is protected.

Uploaded the .env file here. env-Gaemghost20000.zip

let me know if you need any more info or could provide any other troubleshooting method

Gaemghost20000 commented 8 months ago

@AryanVerma1024 I see you've just submitted another commit. thought ill update quickly

New error

PS D:\Games\Expeditions - A MudRunner Game\Expeditions-Mod-Installer-main> .\ModIO_EXP.ps1 ERROR: AccessToken or UserProfile or ModsDir not set in .env file

,env is the same, if incorrect LMK and ive noticed that i might of got the thing for the ACCESS_TOKEN wrong, ill try and corrected that now and see if i can get it working

Gaemghost20000 commented 8 months ago

new commit 3998616 new (old) error

PS D:\Games\Expeditions - A MudRunner Game\Expeditions-Mod-Installer-main> .\ModIO_EXP.ps1

    Directory: C:\Users\Public\Documents\Steam\RUNE\2477340\remote

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
d-----         7/03/2024  12:26 am                cache
Get-Content : Access to the path 'C:\Users\gaemz\Documents\My Games\Expeditions\base\Mods\.modio\mods' is denied.
At D:\Games\Expeditions - A MudRunner Game\Expeditions-Mod-Installer-main\ModIO_EXP.ps1:87 char:20
+ $UserProfileJson = Get-Content -Path $env:USER_PROFILE
+                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : PermissionDenied: (C:\Users\gaemz\...ods\.modio\mods:String) [Get-Content], Unauthorized
   AccessException
    + FullyQualifiedErrorId : GetContentReaderUnauthorizedAccessError,Microsoft.PowerShell.Commands.GetContentCommand

Cannot index into a null array.
At D:\Games\Expeditions - A MudRunner Game\Expeditions-Mod-Installer-main\ModIO_EXP.ps1:88 char:8
+ while ($UserProfileJson[-1] -ne "}") {
+        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : NullArray

ERROR: UserProfile is not valid

---ran with -d for debug---

PS D:\Games\Expeditions - A MudRunner Game\Expeditions-Mod-Installer-main> .\ModIO_EXP.ps1 -d
DEBUG: Mods dir : C:\Users\Public\Documents\Steam\RUNE\2477340\remote\user_profile.cfg
DEBUG: User profile : C:\Users\gaemz\Documents\My Games\Expeditions\base\Mods\.modio\mods
DEBUG: Access token : eyJlbmMiOi...nUmmMUFX2A
DEBUG: Cache dir : C:\Users\Public\Documents\Steam\RUNE\2477340\remote\user_profile.cfg\..\cache
Get-Content : Access to the path 'C:\Users\gaemz\Documents\My Games\Expeditions\base\Mods\.modio\mods' is denied.
At D:\Games\Expeditions - A MudRunner Game\Expeditions-Mod-Installer-main\ModIO_EXP.ps1:87 char:20
+ $UserProfileJson = Get-Content -Path $env:USER_PROFILE
+                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : PermissionDenied: (C:\Users\gaemz\...ods\.modio\mods:String) [Get-Content], Unauthorized
   AccessException
    + FullyQualifiedErrorId : GetContentReaderUnauthorizedAccessError,Microsoft.PowerShell.Commands.GetContentCommand

Cannot index into a null array.
At D:\Games\Expeditions - A MudRunner Game\Expeditions-Mod-Installer-main\ModIO_EXP.ps1:88 char:8
+ while ($UserProfileJson[-1] -ne "}") {
+        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : NullArray

ERROR: UserProfile is not valid

---Changed USER_PROFILE = D:\Games\ExpIO for testing known good folder.

PS D:\Games\Expeditions - A MudRunner Game\Expeditions-Mod-Installer-main> .\ModIO_EXP.ps1 -d
DEBUG: Mods dir : C:\Users\Public\Documents\Steam\RUNE\2477340\remote\user_profile.cfg
DEBUG: User profile : D:\Games\ExpIO
DEBUG: Access token : eyJlbmMiOi...nUmmMUFX2A
DEBUG: Cache dir : C:\Users\Public\Documents\Steam\RUNE\2477340\remote\user_profile.cfg\..\cache
Get-Content : Access to the path 'D:\Games\ExpIO' is denied.
At D:\Games\Expeditions - A MudRunner Game\Expeditions-Mod-Installer-main\ModIO_EXP.ps1:87 char:20
+ $UserProfileJson = Get-Content -Path $env:USER_PROFILE
+                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : PermissionDenied: (D:\Games\ExpIO:String) [Get-Content], UnauthorizedAccessException
    + FullyQualifiedErrorId : GetContentReaderUnauthorizedAccessError,Microsoft.PowerShell.Commands.GetContentCommand

Cannot index into a null array.
At D:\Games\Expeditions - A MudRunner Game\Expeditions-Mod-Installer-main\ModIO_EXP.ps1:88 char:8
+ while ($UserProfileJson[-1] -ne "}") {
+        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : NullArray

ERROR: UserProfile is not valid
PS D:\Games\Expeditions - A MudRunner Game\Expeditions-Mod-Installer-main>

Thanks for the quick updates :) To be honest. I wouldn't be surprised if this issue is because win11 or win11 for workstation and some weird security settings

Gaemghost20000 commented 8 months ago

Who would of guessed that win11 ships with a ver old ver of PS was on 5.1, updated to PS7

PS D:\Games\Expeditions - A MudRunner Game\Expeditions-Mod-Installer-main> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      7.4.1
PSEdition                      Core
GitCommitId                    7.4.1
OS                             Microsoft Windows 10.0.22631
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

PS D:\Games\Expeditions - A MudRunner Game\Expeditions-Mod-Installer-main> .\ModIO_EXP.ps1 -d
DEBUG: Mods dir : C:\Users\Public\Documents\Steam\RUNE\2477340\remote\user_profile.cfg
DEBUG: User profile : C:\Users\gaemz\Documents\My Games\Expeditions\base\Mods\.modio\mods
DEBUG: Access token : eyJlbmMiOi...nUmmMUFX2A
DEBUG: Cache dir : C:\Users\Public\Documents\Steam\RUNE\2477340\remote\user_profile.cfg\..\cache
Get-Content: D:\Games\Expeditions - A MudRunner Game\Expeditions-Mod-Installer-main\ModIO_EXP.ps1:87
Line |
  87 |  $UserProfileJson = Get-Content -Path $env:USER_PROFILE
     |                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Unable to get content because it is a directory: 'C:\Users\gaemz\Documents\My
     | Games\Expeditions\base\Mods\.modio\mods'. Please use 'Get-ChildItem' instead.
InvalidOperation: D:\Games\Expeditions - A MudRunner Game\Expeditions-Mod-Installer-main\ModIO_EXP.ps1:88
Line |
  88 |  while ($UserProfileJson[-1] -ne "}") {
     |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Cannot index into a null array.
ERROR: UserProfile is not valid
PS D:\Games\Expeditions - A MudRunner Game\Expeditions-Mod-Installer-main>
LuminarLeaf commented 8 months ago

DEBUG: Mods dir : C:\Users\Public\Documents\Steam\RUNE\2477340\remote\user_profile.cfg DEBUG: User profile : C:\Users\gaemz\Documents\My Games\Expeditions\base\Mods.modio\mods

huh

Gaemghost20000 commented 8 months ago

sorry, i know how that happened. Readme goes MODS_DIR USER_PROFILE

env file goes

USER_PROFILE MODS_DIR

hah, again sorry...

image

anyway i think i updated, USER_PROFILE now points to the user_profile.cfg

image

Gaemghost20000 commented 8 months ago

update...

PS D:\Games\Expeditions - A MudRunner Game\Expeditions-Mod-Installer-main> .\ModIO_EXP.ps1 -d
DEBUG: Mods dir : C:\Users\gaemz\Documents\My Games\Expeditions\base\Mods\.modio\mods
DEBUG: User profile : C:\Users\Public\Documents\Steam\RUNE\2477340\remote\user_profile.cfg
DEBUG: Access token : eyJlbmMiOi...nUmmMUFX2A
DEBUG: Cache dir : C:\Users\gaemz\Documents\My Games\Expeditions\base\Mods\.modio\mods\..\cache
Getting subscribed mods...
DEBUG: @{data=System.Object[]; result_count=2; result_offset=0; result_limit=100; result_total=2}
Installing mod 3802724 (Z2 Attack Buggy)...
--> Downloading thumbs --> OK
--> Creating modio.json --> OK
--> Downloading mod
--> OK
--> Extracting mod 3802724 (Z2 Attack Buggy)...
--> OK
Installing mod 3807534 (GGMS Money Trucks)...
--> Downloading thumbs --> OK
--> Creating modio.json --> OK
--> Downloading mod
--> OK
--> Extracting mod 3807534 (GGMS Money Trucks)...
--> OK
Get-Member: D:\Games\Expeditions - A MudRunner Game\Expeditions-Mod-Installer-main\ModIO_EXP.ps1:230
Line |
 230 |  $modsInstalled | Get-Member -MemberType NoteProperty | Select-Object  …
     |                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | You must specify an object for the Get-Member cmdlet.
InvalidOperation: D:\Games\Expeditions - A MudRunner Game\Expeditions-Mod-Installer-main\ModIO_EXP.ps1:244
Line |
 244 |  $UserProfileJson.userprofile.modDependencies.SslValue.dependencies =  …
     |  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | The property 'dependencies' cannot be found on this object. Verify that the property exists and can be set.
DEBUG: Mods Installed: {"3802724":[],"3807534":[]}
Updating userprofile...
Done
Press Enter to continue...:
Gaemghost20000 commented 8 months ago

READY FOR CLOSUER.

Gosh i feel really dumb :L i really hope it wasn't just that

image