Code Monkey home page Code Monkey logo

mem-zone / mem.zone Goto Github PK

View Code? Open in Web Editor NEW
89.0 12.0 8.0 19.42 MB

Our โ™ก collection of PowerShell scripts and Endpoint Management related stuff ๐Ÿต

Home Page: https://MEM.Zone/GIT

License: GNU General Public License v3.0

PowerShell 81.72% TSQL 10.91% Shell 6.96% VBScript 0.20% Python 0.10% Visual Basic .NET 0.10%
azure bash-script configmgr dashboards intune macos munki powershell powershell-script powershell-scripts

mem.zone's People

Contributors

ahpooch avatar asg2ki avatar ioan-popovici avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mem.zone's Issues

[BUG] Less free space each time the cleanup script has been run

Describe the bug
When running the script several times on a machines it keeps getting less and less free space. Where does the space go.

Normally the script should be run once, thats where I found that I had less free space then before running the script.

To Reproduce
Steps to reproduce the behavior:

  1. Install a blank windows 10 21H2
  2. Run the script several times and watch free space going down everytime

Expected behavior
The free space should be consistant

Desktop (please complete the following information):

  • OS: Windows 10

[FEATURE] Would it be possible to add the ability to email a report, or send to a Teams Channel via webhook?

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

It's not related to a problem. But thanks for potentially considering it!

Describe the solution you'd like
A clear and concise description of what you want to happen.

A formatted email, containing the list of computers that were disabled, so as to inform managers/colleagues/Service Desk of the computers that were disabled, should a user call in.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

I've cobbled together my own, but it could be more elegant.

Additional context
Add any other context or screenshots about the feature request here.

[BUG] Disk Cleanup stays open in the background

Describe the bug
Even though disk cleanup launch and run properly, it stays open forever in the background and I have to manually kill the process every single time.

Maybe a kill command could be launched after a certain wait time?

Expected behavior
Disk Cleanup should close automatically when done and the script should continue.

Desktop (please complete the following information):

  • OS: Windows 11 21H2

Get-CimInstance : Invalid class | HRESULT 0x80041010

After some latest updates on our systems (after Sep/2021), we are getting the below error while running the script Clean-CMClientCache.ps1...

PS C:\Tools> .\Clean-CMClientCache.ps1
Get-CimInstance : Invalid class
At C:\Tools\Clean-CMClientCache.ps1:1601 char:32
+ ... SuperPeer = Get-CimInstance -Namespace 'root\ccm\Policy\Machine\Actua ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : MetadataError: (root\ccm\Policy...eerClientConfig:String) [Get-CimInstance], CimException
    + FullyQualifiedErrorId : HRESULT 0x80041010,Microsoft.Management.Infrastructure.CimCmdlets.GetCimInstanceCommand

[10-29-2021 13:10:53.315] [Main:CleanupResult] [Clean-CMClientCache] :: TotalDeletedSize: 0

Which is basically triggered by this call...

PS C:\Tools> Get-CimInstance -Namespace 'root\ccm\Policy\Machine\ActualConfig' -ClassName 'CCM_SuperPeerClientConfig' -Verbose:$true
VERBOSE: Perform operation 'Enumerate CimInstances' with following parameters, ''namespaceName' = root\ccm\Policy\Machine\ActualConfig,'className' =
CCM_SuperPeerClientConfig'.
Get-CimInstance : Invalid class
At line:1 char:1
+ Get-CimInstance -Namespace 'root\ccm\Policy\Machine\ActualConfig' -Cl ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : MetadataError: (root\ccm\Policy...eerClientConfig:String) [Get-CimInstance], CimException
    + FullyQualifiedErrorId : HRESULT 0x80041010,Microsoft.Management.Infrastructure.CimCmdlets.GetCimInstanceCommand

VERBOSE: Operation 'Enumerate CimInstances' complete.

On Windows Server 2012 R2 and Windows Server 2016 machines.

For PS version 5.1+

PS C:\Tools> $PSVersionTable
Name                           Value
----                           -----
PSVersion                      5.1.14409.1018
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.14409.1018
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

HW BIOS Report Wont Run

This was even after making sure the DataSet was pointed correctly

For more information about this error navigate to the report server on the local server machine, or enable remote errors

Query execution failed for dataset 'ReportDescription'. (rsErrorExecutingCommand)

An error has occurred during report processing. (rsProcessingAborted)

[BUG] Invoke-CCMCacheCleanup - Not detecting or removing most content.

Hi loan,
I was looking to upgrade from the Technet version of this script (as this version seems so much more polished!) however I'm noticing in testing that most of the content in my test devices cache's is being skipped over.
I'm using the following Parameters:
Action = All
FreeSpace = 100
OlderThan = 0
$RemovePersisted = $true
SkipSuperPeer = $false

For Example on one Server I have 10 Cache Entries mostly containing Update CAB's at around 1.5gig each some of which are from January this year, but running the script doesn't seem to detect they're to be removed.
Checking the last referenced time in WMI shows they're old.
$Cachepath = ([wmi]"ROOT\ccm\SoftMgmtAgent:CacheConfig.ConfigKey='Cache'").Location
$cache = get-wmiobject -query "SELECT * FROM CacheInfoEx" -namespace "ROOT\ccm\SoftMgmtAgent"
Foreach ($cacheitem in $cache) {
$cacheitem.contentID
[Management.ManagementDateTimeConverter]::ToDateTime($cacheitem.LastReferenced)
}

NCU00008
21 January 2020 00:40:45
448ef3f9-86e9-497b-954e-653286ad418f
01 April 2020 01:33:28
NCU00003
28 November 2019 14:14:37
NCU00003
13 February 2020 16:19:56
8a7ad16e-b78e-4b88-91fe-35362d9b69a7
02 June 2020 04:41:12
9b842fe4-2040-40fe-be18-4b88dd88950f
05 February 2020 01:50:05
381e77dc-f15f-4c71-84e1-32d60f26e71a
01 April 2020 01:32:12
a0203bcb-ff0e-42cb-99de-72f265c2426e
08 January 2020 01:25:04
24a6254e-dea0-4acd-ac4f-ae70abd62cdc
19 February 2020 01:22:35
aff2af4a-fb0d-4371-9c90-24a42b3fe359
15 February 2020 04:54:03

Skipping virtually all cached items

I'm hoping this isn't a simple mistake on my part but running this script on a device with administrative access and 35 separate items in the ccmcache results in only 2 being visible when the script is run. I have tried modifying the thresholds as I want it to be fairly aggressive in it's cleanup but it will not spot the remaining 33 items.

No errors logged, results below:

PS C:\sparke\scripts> .\Clean-CMClientCache.ps1 -verbose
VERBOSE: [03-08-2022 16:45:11.436] [Main:Initialization] [Clean-CMClientCache] :: Start
VERBOSE: [03-08-2022 16:45:11.530] [Main:Initialization] [Clean-CMClientCache] :: Should Run test passed
VERBOSE: [03-08-2022 16:45:11.530] [Main:Initialization] [Clean-CMClientCache] :: Stop
VERBOSE: [03-08-2022 16:45:11.546] [Remove-CCMCachedApplications] [Clean-CMClientCache] :: Start
VERBOSE: [03-08-2022 16:45:11.561] [Get-CCMCachedApplications] [Clean-CMClientCache] :: Start
VERBOSE: [03-08-2022 16:45:11.655] [Clean-CMClientCache] :: Stop
VERBOSE: [03-08-2022 16:45:11.671] [Remove-CCMCachedApplications] [Clean-CMClientCache] :: Stop
VERBOSE: [03-08-2022 16:45:11.682] [Remove-CCMCachedPackages] [Clean-CMClientCache] :: Start
VERBOSE: [03-08-2022 16:45:11.687] [Get-CCMCachedPackages] [Clean-CMClientCache] :: Start
VERBOSE: [03-08-2022 16:45:11.735] [Get-CCMCachedPackages] [Clean-CMClientCache] :: Stop
VERBOSE: [03-08-2022 16:45:11.735] [Remove-CCMCachedPackages] [Clean-CMClientCache] :: Stop
VERBOSE: [03-08-2022 16:45:11.751] [Clean-CMClientCache] :: Start
VERBOSE: [03-08-2022 16:45:11.751] [Get-CCMCachedUpdates] [Clean-CMClientCache] :: Start
VERBOSE: [03-08-2022 16:45:13.235] [Get-CCMCachedUpdates] [Clean-CMClientCache] :: Stop
VERBOSE: [03-08-2022 16:45:13.235] [Remove-CCMCachedUpdates] [Clean-CMClientCache] :: Stop
VERBOSE: [03-08-2022 16:45:13.250] [Remove-CCMOrphanedCache] [Clean-CMClientCache] :: Start
VERBOSE: [03-08-2022 16:45:13.409] [Remove-CCMOrphanedCache] [Clean-CMClientCache] :: Stop
[03-08-2022 16:45:13.425] [Main:CleanupResult] [Clean-CMClientCache] ::

FullName :
Name : 5009469
Location : C:\WINDOWS\ccmcache\1r
LastReferenceTime : 1/03/2022 2:33:08 AM
Size(MB) :
Status : Needed

FullName :
Name : 5008880
Location : C:\WINDOWS\ccmcache\1s
LastReferenceTime : 1/03/2022 2:33:57 AM
Size(MB) :
Status : Needed

TotalDeletedSize: 0
VERBOSE: [03-08-2022 16:45:13.425] [Main:CleanupResult] [Clean-CMClientCache] :: Stop
PS C:\sparke\scripts>

Any idea's what may be going on here?

[BUG] Broken Link (404)

IF YOU SEE THIS, THE LINK WAS PROBABLY BROKEN

PLEASE REPORT IT BY COMMENTING TO THIS ISSUE

Error On Line 831 - When No User Has Logged Onto Device

Howdy Ioan,

I found an issue if you have no users that have logged onto the device yet, at least in my environment, you get an error when trying to populate the $Packages variable. The error is a generic failure when trying to access the namespace. I would suggest adding ErrorAction SilentlyContinue to that line as so. I will try to attach the full error if I can get to it.
$Packages = Get-CimInstance -Namespace 'Root\ccm\ClientSDK' -ClassName 'CCM_Program' -Verbose:$false -ErrorAction SilenetlyContinue

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.