guyrleech / microsoft Goto Github PK
View Code? Open in Web Editor NEWScripts and tools for use with Microsoft products/technologies
License: MIT License
Scripts and tools for use with Microsoft products/technologies
License: MIT License
Hi,
first, thanks for this script.
I have tried it now and get the following error when I run Trim idle task:
`
False : The term 'False' 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 line:1 char:1
+ CategoryInfo : ObjectNotFound: (False:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
False : The term 'False' 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 line:1 char:1
+ CategoryInfo : ObjectNotFound: (False:String) [], CommandNotFou
ndException
+ FullyQualifiedErrorId : CommandNotFoundException
Task is calling this:
powershell.exe -NoProfile -ExecutionPolicy Bypass -File C:\TEMP\Trimmer.ps1 -ThisSession -scheduled -Idle 600 -background -above 10485760 -available False -logfile C:\TEMP\MemoryOptimization.log -processes firefox,iexplore`
Transscript:
VERBOSE: Perform operation 'Query CimInstances' with following parameters, ''queryExpression' = SELECT TotalPhysicalMemory FROM Win32_ComputerSystem,'queryDialect' = WQL,'namespaceName' = root\cimv2'.
VERBOSE: Operation 'Query CimInstances' complete.
VERBOSE: Available memory is 5797MB out of 8191MB total (71%)
False : The term 'False' 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 line:1 char:1
+ False
+ ~~~~~
+ CategoryInfo : ObjectNotFound: (False:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
False : The term 'False' 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 line:1 char:1
+ False
+ ~~~~~
+ CategoryInfo : ObjectNotFound: (False:String) [], CommandNotFou
ndException
+ FullyQualifiedErrorId : CommandNotFoundException
VERBOSE: Not trimming as memory available is above specified threshold
Hi Guy,
I'm interested in using some of the code in this repo but there's no license. Would you be willing to apply a license?
Thanks,
Travis
Using -Processes firefox,iexplore seems to do not optimize Memory for these processes.
If I remove the Processes parameter it works well.
powershell.exe -NoProfile -ExecutionPolicy Bypass -File C:\TEMP\Trimmer.ps1 -ThisSession -scheduled -above 10485760 -logfile C:\TEMP\MemoryOptimization.log -Processes "firefox","iexplore" -Verbose
Verbose Logging:
VERBOSE: Skipping firefox pid 7868 as not specified process
VERBOSE: Skipping iexplore pid 2128 as not specified process
VERBOSE: Skipping iexplore pid 4528 as not specified process
VERBOSE: Skipping iexplore pid 8540 as not specified process
VERBOSE: Skipping iexplore pid 8608 as not specified process
It seems that you are trying to compare to $process.Name but it should be $process.ProcessName and if you put this $processes = $processes.Split(",") before Get-Process routine it works.
To speed up Get-Process I would supply $processes with parameter Name if processes are present, it should be faster...
Hello,
once again thanx for sharing.
I have to comment on an error i am receiving:
"Exception calling "ToDateTime" with "1" argument(s): "Specified argument was out of the range of valid values. (Parameter 'dmtfDate')""
With the CIM cmdlets, you don't need to manually convert DateTimes:
(Get-CimInstance Win32_OperatingSystem -computername $using:Server).LastBootUpTime
Will just be a standard DateTime object now.
so
line 201: [string]$rawBootTime = Get-CimInstance -Class Win32_OperatingSystem -ComputerName $machineName -ErrorAction SilentlyContinue | Select-Object -ExpandProperty LastBootUpTime
should now become :
$rawBootTime = (Get-CimInstance -Class Win32_OperatingSystem -ComputerName $machineName -ErrorAction SilentlyContinue).LastBootUpTime
and
line 204: $bootTime = [Management.ManagementDateTimeConverter]::ToDateTime( $rawBootTime )
should become :
$bootTime = $rawBootTime
Hello,
great work. I have to comment on an error i am getting.
"The term 'Get-WmiObject' is not recognized as a name of a cmdlet, function, script file, or executable program."
The cmdlet get-ciminstance could be used instead. Just find and replace the "get-wmiobject" with "get-ciminstance" in the code and it works like a charm.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.