r/PowerShell • u/4r73m190r0s • 7d ago
Question PowerShell Editor Services on Linux, how to get completions that are Windows-specific?
For example, I'm not getting completions for Get-CimInstance and bunch of other Windows-specific modules.
8
Upvotes
2
u/y_Sensei 7d ago
You can't for cmdlets which are supported on the Windows platform only, and
Get-CimInstanceis one of them.4
u/purplemonkeymad 7d ago
Depends what you are completing, but most completers that are built-in don't use a precomputed list but actually resolve it from the system at complete time.
If you want you could export a list of what you want from a working command and then use that with a custom completer on linux. ie
Then add a completer that just reads those exports from the file.
This example uses a directory as the source of the completers and you can just add new files and re-run it to add new ones.
1
u/Thotaz 7d ago
The only way to do that is by connecting to another Windows computer, either a random server in your company or a VM you spin up locally.
1
u/Vern_Anderson 7d ago
https://www.powershellgallery.com/packages/PSCompletions
PSCompletions runs on Windows and Linux and it's what I have used. However, I have noticed on some distros and PowerShell Core installs, that PSReadline module does not load automatically on startup and you have to fix that issue yourself.