Giter Club home page Giter Club logo

psccmclient's Introduction

PSCCMClient PowerShell Module

PowerShell module focused around interaction with the Microsoft Endpoint Manager Configuration Manager (MEMCM) client. The general theme is to provide functions that 'work as expected' in that they accept pipeline where possible, such as with the below example, as well as an array of Computer Names, CimSessions, or PSSessions.

Get-CCMUpdate | Invoke-CCMUpdate
Get-CCMPackage -PackageName 'Install Company Software' -ComputerName Workstation1 | Invoke-CCMPackage
Get-CCMServiceWindow | ConvertFrom-CCMSchedule
Get-CCMBaseline -BaselineName 'Cache Management' -CimSession $CimSession1 | Invoke-CCMBaseline
Get-CCMApplication -ApplicationName '7-Zip' -ComputerName Workstation1 | Invoke-CCMApplication -Method Uninstall

Largely this is leveraging CIM to gather info, and act upon it. This is why there are custom functions to make registry edits, and gather registry info via CIM. By consistently using CIM, we can ensure that a CimSession can be used for efficiency. A PSSession parameter is also available on all functions for an alternative remote connection. In some cases, invoking certain CIMMethods over a CIMSession is not available because some CIM methods for the MEMCM client do not work well remotely over CIM. This can be seen with the methods on SMS_CLIENT in the root\CCM Namespace and by trying to invoke updates remotely with CIM. There are functions that allow executing arbitrary code via the Win32_Process:CreateProcess method. In order to do this, code is converted to, and from Base64. This might be a red flag for enterprise AV.

I encourage anyone that wants to contribute to start picking away! I'm currently using VSCode to develop this module, and as part of that I'm using the 'TODO Tree' extension to make brief notes regarding future work that needs done.

Current list of functions:

  • ConvertFrom-CCMLogFile
    • Alias: Get-CCMLogFile
  • ConvertFrom-CCMSchedule
  • ConvertTo-CCMLogFile
  • Get-CCMApplication
  • Get-CCMBaseline
    • Alias: Get-CCMCB
  • Get-CCMCacheContent
  • Get-CCMCacheInfo
  • Get-CCMCimInstance
  • Get-CCMClientDirectory
  • Get-CCMClientInfo
  • Get-CCMClientVersion
  • Get-CCMCurrentManagementPoint
    • Alias: Get-CCMCurrentMP
    • Alias: Get-CCMMP
  • Get-CCMCurrentSoftwareUpdatePoint
    • Alias: Get-CCMCurrentSUP
    • Alias: Get-CCMSUP
  • Get-CCMCurrentWindowAvailableTime
  • Get-CCMDNSSuffix
  • Get-CCMExecStartupTime
  • Get-CCMGUID
  • Get-CCMLastHardwareInventory
    • Alias: Get-CCMLastHINV
  • Get-CCMLastHeartbeat
    • Alias: Get-CCMLastDDR
  • Get-CCMLastScheduleTrigger
  • Get-CCMLastSoftwareInventory
    • Alias: Get-CCMLastSINV
  • Get-CCMLoggingConfiguration
  • Get-CCMMaintenanceWindow
    • Alias: Get-CCMMW
  • Get-CCMPackage
  • Get-CCMPrimaryUser
  • Get-CCMProvisioningMode
  • Get-CCMRegistryProperty
    • Alias: Get-CIMRegistryProperty
  • Get-CCMServiceWindow
  • Get-CCMSite
  • Get-CCMSoftwareUpdate
    • Alias: Get-CCMUpdate
  • Get-CCMSoftwareUpdateGroup
    • Alias: Get-CCMSUG
  • Get-CCMSoftwareUpdateSettings
  • Get-CCMTaskSequence
  • Invoke-CCMApplication
  • Invoke-CCMBaseline
  • Invoke-CCMClientAction
  • Invoke-CCMCommand
  • Invoke-CCMPackage
  • Invoke-CCMResetPolicy
  • Invoke-CCMSoftwareUpdate
    • Alias: Invoke-CCMUpdate
  • Invoke-CCMTaskSequence
  • Invoke-CCMTriggerSchedule
  • Invoke-CIMPowerShell
  • New-LoopAction
  • Remove-CCMCacheContent
  • Repair-CCMCacheLocation
  • Set-CCMCacheLocation
  • Set-CCMCacheSize
  • Set-CCMClientAlwaysOnInternet
  • Set-CCMDNSSuffix
  • Set-CCMLoggingConfiguration
  • Set-CCMManagementPoint
    • Alias: Set-CCMMP
  • Set-CCMProvisioningMode
  • Set-CCMRegistryProperty
    • Alias: Set-CIMRegistryProperty
  • Set-CCMSite
  • Test-CCMIsClientAlwaysOnInternet
  • Test-CCMIsClientOnInternet
  • Test-CCMIsWindowAvailableNow
  • Test-CCMStaleLog
  • Write-CCMLogEntry

psccmclient's People

Contributors

codymathis123 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

psccmclient's Issues

Error when importing modult

Hello, i'm getting error when trying to import the module.
what i did so far was

  1. create new folder 'C:\Program Files\WindowsPowerShell\Modules\PSCCMClient
  2. copy all files from the git repo Source to new folder
    hope you can help
    thx

Import-Module : The module to process 'PSCCMClient.psm1', listed in field 'ModuleToProcess/RootModule' of module
manifest 'C:\Program Files\WindowsPowerShell\Modules\PSCCMClient\PSCCMClient.psd1' was not processed because no valid
module was found in any module directory.
At line:1 char:1

  • Import-Module PSCCMClient
  •   + CategoryInfo          : ResourceUnavailable: (PSCCMClient:String) [Import-Module], PSInvalidOperationException
      + FullyQualifiedErrorId : Modules_ModuleFileNotFound,Microsoft.PowerShell.Commands.ImportModuleCommand
    

Ability to load lazy properties

A number of CM classes use lazy-loaded properties, such as AppDTs (deployment types) on CCM_Application - it'd be great if the functions had the option to load them. This is easiest done by piping the output from Get-CimInstance for these classes back in to Get-CimInstance, so there is a performance implication and significantly more network activity and it's probably best off by default.

Invoke-CCMSoftwareUpdate gives status False

hello,
whats could be the reason for getting the below results ?
There are 3 pending OS updates on the host1 but im not able to trigger the installation :(

Get-CCMSoftwareUpdate -ComputerName host1 | Invoke-CCMSoftwareUpdate

ComputerName Invoked


host1 False
host1 False
host1 False

ConvertFrom-CCMSchedule : Parsing Schedule String resulted in invalid type of 6

With certain schedules, I get the above error in MCM. I looked over the WMI and I don't see anything particular about this return value:

https://learn.microsoft.com/en-us/mem/configmgr/develop/reference/core/servers/configure/sms_scheduletoken-server-wmi-class

The value returned from the function looks like this:

SmsProviderObjectPath :
DayDuration : 0
HourDuration : 4
MinuteDuration : 0
IsGMT : False
StartTime : 7/28/2023 2:00:00 AM

To assist with this, I'll add a schedule token returned that generates the error: 005C7D4020331680

Adding some more to this, according to our MCM admins, Microsoft recently added the ability to add a "Days Offset" parameter to the options available for 'SMS_ST_RecurMonthlyByWeekday', which seems to have resulted in a new, but undocumented, SMS Provider for scheduling:

https://learn.microsoft.com/en-us/mem/configmgr/develop/reference/core/servers/configure/sms_st_recurmonthlybyweekday-server-wmi-class

I see nothing related to it following that link.

FYI- I was able to get the new recurrence type details from Microsoft. It is returned by using the Convert-CMSchedule cmdlet in the CM PowerShell module:

SmsProviderObjectPath : SMS_ST_RecurMonthlyByWeekdayBase
Day : 3
DayDuration : 0
ForNumberOfMonths : 1
HourDuration : 4
IsGMT : False
MinuteDuration : 0
OffsetDay : 2
StartTime : 7/28/2023 2:00:00 AM
WeekOrder : 3

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.