-
Notifications
You must be signed in to change notification settings - Fork 89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add PSEdition Desktop requirement #28
base: master
Are you sure you want to change the base?
Conversation
@damienvanrobaeys Should this be closed too? |
As a note from my side: I think it would be smarter not to block powershell 7 but rather adjust the scripts to use both. For get-wmitobject the get-ciminstance cmdlet could be used instead, they are quite interchangeable.
should do the trick for cases where there is no equivalent cmdlet for newer versions of powershell and then give a notification to the user |
I mean, sure, but this would be a good stopgap until that's sorted out. |
@damienvanrobaeys How about running Checkpoint-Computer by directly calling |
Imo this is quite a smart idea, could you implement that? Unfortunately it wont change the fact, that get-wmiobject is not available in pwsh, so we would still need a workaround for that, but i could try to implement that and make a separate pr for it |
I'm working on it to run checkpoint-computer using powershell if currently running in pwsh |
Solved this with this: |
Why the hassle with if/else? Just use try/catch and you dont need a separate variable for the whole command |
There shouldn't be anything that Get-WmiObject can do that Get-CIMInstance can't, to my knowledge, and Get-CIMInstance is compatible with both. |
Ye, that is true. So i guess try/catch for checkpoint-computer and get-ciminstance should make this compatible with pwsh and remain it with powershell |
I updated add_structure.ps1 with checkpoint-computer running with start-process powershell for al versions |
I ran Add-Structures.ps1 on PowerShell 7 without knowing any better, which doesn't offer the
Get-WmiObject
orCheckpoint-Computer
commands.#Requires -PSEdition Desktop
will prevent PowerShell 7 from running these scripts since it will require the Windows-specific version of PowerShell: 5.1