Import PowerShell module one-liner



# works
PowerShell.exe -nologo -command "Import-Module PSWindowsUpdate; Get-Module"

# nothing costom is enabled
PowerShell.exe -nologo -command "Get-Module"

# wrong order obviously
PowerShell.exe -nologo -command "Get-Module; Import-Module PSWindowsUpdate"

# general syntax
PowerShell.exe -nologo -command "Import-Module PSWindowsUpdate; (Get-Module)"

No comments: