It is currently October 25th, 2021, 6:34 am

PowerShell on Windows 7 issue

General topics related to Rainmeter.
User avatar
Active Colors
Moderator
Posts: 872
Joined: February 16th, 2012, 3:32 am
Location: Berlin, Germany

PowerShell on Windows 7 issue

Post by Active Colors »

I have:

Updated PowerShell from 1.0 to the latest 7.1 version.
Installed prerequisite Windows Management Framework (WMF) 5.1.
Installed .Net Framework 4.8 (minimum required 4.5 as indicated by MS).


Rainmeter skin:
Capture.PNG

PowerShell report:
2.PNG

Rainmeter Log report:

Code: Select all

System.Management.Automation.CommandNotFoundException: The term 'Get-Partition' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
   at System.Management.Automation.Runspaces.PipelineBase.Invoke(IEnumerable input)
   at PowershellRM.ParentMeasure.Reload() (#Test\Atest.ini - [MeasureGetDriveMedia])

What can be the problem?
You do not have the required permissions to view the files attached to this post.
User avatar
Active Colors
Moderator
Posts: 872
Joined: February 16th, 2012, 3:32 am
Location: Berlin, Germany

Re: PowerShell on Windows 7 issue

Post by Active Colors »

Is there some simple skin which uses PowerShell which I can test? Maybe this is the command problem not supported on Windows 7.
User avatar
jsmorley
Developer
Posts: 22374
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: PowerShell on Windows 7 issue

Post by jsmorley »

Code: Select all

[Rainmeter]
Update=1000
AccurateText=1
DynamicWindowSize=1
OnRefreshAction=[!CommandMeasure MeasureRun "Run"]

[MeasureRun]
Measure=Plugin
Plugin=RunCommand
OutputType=ANSI
Program=PowerShell
Parameter=$PSVersionTable
FinishAction=[!UpdateMeter MeterOutput][!Redraw]

[MeterOutput]
Meter=String
MeasureName=MeasureRun
ClipStringW=500
ClipString=2
FontSize=11
FontWeight=400
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
You might want to open a PowerShell window "As Administrator" and run:

Set-ExecutionPolicy Unrestricted
User avatar
Yincognito
Rainmeter Sage
Posts: 4070
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: PowerShell on Windows 7 issue

Post by Yincognito »

Active Colors wrote: July 14th, 2021, 10:27 pmMaybe this is the command problem not supported on Windows 7.
Get-Partition is supported in Windows 7 (and probably PS 2.0 as well). What's supported only from PS 3.0 and up is the Where-Object cmdlet.

However, since you installed everything needed, it should work, assuming the scripts execution is permitted, as jsmorley mentioned. Maybe a restart could help? :confused:

P.S. You probably know this already, but just in case you somehow missed something, these are the PS requirements.
User avatar
death.crafter
Posts: 1065
Joined: April 24th, 2021, 8:13 pm

Re: PowerShell on Windows 7 issue

Post by death.crafter »

Active Colors wrote: July 14th, 2021, 9:56 pm
I have:

Updated PowerShell from 1.0 to the latest 7.1 version.
Installed prerequisite Windows Management Framework (WMF) 5.1.
Installed .Net Framework 4.8 (minimum required 4.5 as indicated by MS).


Rainmeter skin:
Capture.PNG


PowerShell report:
2.PNG


Rainmeter Log report:

Code: Select all

System.Management.Automation.CommandNotFoundException: The term 'Get-Partition' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
   at System.Management.Automation.Runspaces.PipelineBase.Invoke(IEnumerable input)
   at PowershellRM.ParentMeasure.Reload() (#Test\Atest.ini - [MeasureGetDriveMedia])
What can be the problem?
Try running $PSVersionTable and see if Powershell 7 shows up. Because I am pretty sure, you can't make 7 the default PowerShell. Either it is 5.1 or 1.0. And I recommend you try this in PowerShell Console directly.
from the Realm of Death
My Current Desktop