{"record":{"id":"796bef5c9c74ae8c","repo":"JosefNemec/Playnite","slug":"powershell-3-0-or-newer-is-not-installed","errorCode":null,"errorMessage":"PowerShell 3.0 or newer is not installed.","messagePattern":"PowerShell 3\\.0 or newer is not installed\\.","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"source/Playnite/GamesEditor.cs","lineNumber":1640,"sourceCode":"            bool global,\r\n            GameScriptType type,\r\n            Dictionary<string, object> vars = null)\r\n        {\r\n            if (!execute || script.IsNullOrWhiteSpace())\r\n            {\r\n                return true;\r\n            }\r\n\r\n            try\r\n            {\r\n                if (runtime == null)\r\n                {\r\n                    throw new Exception(\"Cannot execute script, no runtime given.\");\r\n                }\r\n\r\n                if (!PowerShellRuntime.IsInstalled)\r\n                {\r\n                    throw new Exception(resources.GetString(\"LOCErrorPowerShellNotInstalled\"));\r\n                }\r\n\r\n                var scriptVars = new Dictionary<string, object>\r\n                {\r\n                    {  \"PlayniteApi\", Application.PlayniteApiGlobal },\r\n                    {  \"Game\", game.GetCopy() }\r\n                };\r\n\r\n                vars?.ForEach(a => scriptVars.AddOrUpdate(a.Key, a.Value));\r\n                var expandedScript = game.ExpandVariables(script);\r\n                var dir = game.ExpandVariables(game.InstallDirectory, true);\r\n                if (!dir.IsNullOrEmpty() && Directory.Exists(dir))\r\n                {\r\n                    runtime.Execute(expandedScript, dir, scriptVars);\r\n                }\r\n                else\r\n                {\r\n                    runtime.Execute(expandedScript, PlaynitePaths.ProgramPath, scriptVars);\r","sourceCodeStart":1622,"sourceCodeEnd":1658,"githubUrl":"https://github.com/JosefNemec/Playnite/blob/5911f4e964e628aa7a69c2030ab35101afa63067/source/Playnite/GamesEditor.cs#L1622-L1658","documentation":"Thrown by ExecuteScript when PowerShellRuntime.IsInstalled is false — the host machine lacks PowerShell 3.0+, which Playnite requires to run game install/uninstall/etc. scripts. The message is localized via LOCErrorPowerShellNotInstalled.","triggerScenarios":"ExecuteScript is invoked with a non-empty script on a system where PowerShellRuntime.IsInstalled evaluates false (no compatible PowerShell engine detected).","commonSituations":"Running Playnite on a stripped-down Windows image or under Wine/Proton where PowerShell is absent; PowerShell registry keys damaged; security policy uninstalled Windows PowerShell.","solutions":["Install Windows PowerShell 3.0 or newer (Windows Management Framework) on the host.","On Wine/Proton, ensure wine-mono/powershell core is available or run on a host with PowerShell.","Guard UI features that rely on scripts behind a PowerShellRuntime.IsInstalled check so they are disabled gracefully."],"exampleFix":"// before\nif (!PowerShellRuntime.IsInstalled) { throw new Exception(resources.GetString(\"LOCErrorPowerShellNotInstalled\")); }\n\n// after — caller-side capability check\nif (!PowerShellRuntime.IsInstalled && !script.IsNullOrWhiteSpace()) {\n    Dialogs.ShowMessage(\"PowerShell 3.0+ is required to run this game's scripts.\", \"Unsupported\", MessageBoxButton.OK, MessageBoxImage.Warning);\n    return false;\n}","handlingStrategy":"validation","validationCode":"// Check PowerShell availability before offering script-dependent features.\nif (!PowerShellRuntime.IsInstalled) {\n    Dialogs.ShowMessage(\"PowerShell 3.0+ is required.\", \"Unsupported\", MessageBoxButton.OK, MessageBoxImage.Warning);\n    return;\n}","typeGuard":"static bool ScriptingAvailable => PowerShellRuntime.IsInstalled;","tryCatchPattern":null,"preventionTips":["Disable script-based features in the UI when PowerShellRuntime.IsInstalled is false.","Document the PowerShell requirement for users on Wine/Proton.","Detect capability at startup and warn once."],"tags":["scripting","powershell","environment","dependency"],"backgroundTag":null,"analyzedSha":"5911f4e964e628aa7a69c2030ab35101afa63067","analyzedAt":"2026-08-13T17:38:25.713Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}