Important Notice: On February 29th, this community was put into read-only mode. All existing posts will remain but customers are unable to add new posts or comment on existing. Please feel to join our Community Discord for any questions and discussions.

Use Powershell7 (pwsh) for powershell scanner

Dear fellow PDQ users,

is there any possibility to tell PDQ Inventory that it should use powershell 7 for a powershell scanner?

I've built a script to deep search files through all disks and partly unzip them and there are several functions in my script which only work in pwsh7.

So running these scripts locally inside a pwsh shell works fine but it does not work using PDQ inventory since it always starts powershell version 5...

Please help me or tell me when you plan to integrate pwsh7 into pdq :-)

 

Kind regards,

1

Comments

1 comment
Date Votes
  • I don't know about changing what PDQi uses, but you can change what Deploy uses by putting something like this at the top of your powershell scripts.

     

    If ($PSVersionTable.PSVersion.Major -ne 7) { # if not running powershell 7
        Try {
            & "C:\Program Files\PowerShell\7\pwsh.exe" -File $PSCOMMANDPATH
        }
        Catch {
            Throw "Failed to start $PSCOMMANDPATH"
        }
        Exit
    }
    1