├── CODE_OF_CONDUCT.md ├── LICENSE ├── Readme.md ├── Scripts ├── Invoke-BIOSDataCollectionToLA.ps1 ├── Invoke-CustomAppReliability.ps1 ├── Invoke-CustomAppReliabilityWithAPI.ps1 ├── Invoke-DeliveryOptimizationDataGatherScript.ps1 ├── Invoke-WUInventory.ps1 └── Invoke-WUInventory_Funky.ps1 └── Workbooks ├── AppReliabilityDashboard.json ├── AppReliabilityDetails.json ├── BIOSUpdateComplianceOEM.json ├── DeliveryOptimizationDashboard.json ├── DeliveryOptimizationDashboardV3.json ├── IntuneAuditDashboard.json ├── IntuneAuditEventDetails.json ├── UpdateComplianceCommunityEdition.json ├── UpdateComplianceV8.json └── Windows Update Device Settings.workbook /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | We as members, contributors, and leaders pledge to make participation in our 6 | community a harassment-free experience for everyone, regardless of age, body 7 | size, visible or invisible disability, ethnicity, sex characteristics, gender 8 | identity and expression, level of experience, education, socio-economic status, 9 | nationality, personal appearance, race, religion, or sexual identity 10 | and orientation. 11 | 12 | We pledge to act and interact in ways that contribute to an open, welcoming, 13 | diverse, inclusive, and healthy community. 14 | 15 | ## Our Standards 16 | 17 | Examples of behavior that contributes to a positive environment for our 18 | community include: 19 | 20 | * Demonstrating empathy and kindness toward other people 21 | * Being respectful of differing opinions, viewpoints, and experiences 22 | * Giving and gracefully accepting constructive feedback 23 | * Accepting responsibility and apologizing to those affected by our mistakes, 24 | and learning from the experience 25 | * Focusing on what is best not just for us as individuals, but for the 26 | overall community 27 | 28 | Examples of unacceptable behavior include: 29 | 30 | * The use of sexualized language or imagery, and sexual attention or 31 | advances of any kind 32 | * Trolling, insulting or derogatory comments, and personal or political attacks 33 | * Public or private harassment 34 | * Publishing others' private information, such as a physical or email 35 | address, without their explicit permission 36 | * Other conduct which could reasonably be considered inappropriate in a 37 | professional setting 38 | 39 | ## Enforcement Responsibilities 40 | 41 | Community leaders are responsible for clarifying and enforcing our standards of 42 | acceptable behavior and will take appropriate and fair corrective action in 43 | response to any behavior that they deem inappropriate, threatening, offensive, 44 | or harmful. 45 | 46 | Community leaders have the right and responsibility to remove, edit, or reject 47 | comments, commits, code, wiki edits, issues, and other contributions that are 48 | not aligned to this Code of Conduct, and will communicate reasons for moderation 49 | decisions when appropriate. 50 | 51 | ## Scope 52 | 53 | This Code of Conduct applies within all community spaces, and also applies when 54 | an individual is officially representing the community in public spaces. 55 | Examples of representing our community include using an official e-mail address, 56 | posting via an official social media account, or acting as an appointed 57 | representative at an online or offline event. 58 | 59 | ## Enforcement 60 | 61 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 62 | reported to the community leaders responsible for enforcement at 63 | https://msendpointmgr.com. 64 | All complaints will be reviewed and investigated promptly and fairly. 65 | 66 | All community leaders are obligated to respect the privacy and security of the 67 | reporter of any incident. 68 | 69 | ## Enforcement Guidelines 70 | 71 | Community leaders will follow these Community Impact Guidelines in determining 72 | the consequences for any action they deem in violation of this Code of Conduct: 73 | 74 | ### 1. Correction 75 | 76 | **Community Impact**: Use of inappropriate language or other behavior deemed 77 | unprofessional or unwelcome in the community. 78 | 79 | **Consequence**: A private, written warning from community leaders, providing 80 | clarity around the nature of the violation and an explanation of why the 81 | behavior was inappropriate. A public apology may be requested. 82 | 83 | ### 2. Warning 84 | 85 | **Community Impact**: A violation through a single incident or series 86 | of actions. 87 | 88 | **Consequence**: A warning with consequences for continued behavior. No 89 | interaction with the people involved, including unsolicited interaction with 90 | those enforcing the Code of Conduct, for a specified period of time. This 91 | includes avoiding interactions in community spaces as well as external channels 92 | like social media. Violating these terms may lead to a temporary or 93 | permanent ban. 94 | 95 | ### 3. Temporary Ban 96 | 97 | **Community Impact**: A serious violation of community standards, including 98 | sustained inappropriate behavior. 99 | 100 | **Consequence**: A temporary ban from any sort of interaction or public 101 | communication with the community for a specified period of time. No public or 102 | private interaction with the people involved, including unsolicited interaction 103 | with those enforcing the Code of Conduct, is allowed during this period. 104 | Violating these terms may lead to a permanent ban. 105 | 106 | ### 4. Permanent Ban 107 | 108 | **Community Impact**: Demonstrating a pattern of violation of community 109 | standards, including sustained inappropriate behavior, harassment of an 110 | individual, or aggression toward or disparagement of classes of individuals. 111 | 112 | **Consequence**: A permanent ban from any sort of public interaction within 113 | the community. 114 | 115 | ## Attribution 116 | 117 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], 118 | version 2.0, available at 119 | https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. 120 | 121 | Community Impact Guidelines were inspired by [Mozilla's code of conduct 122 | enforcement ladder](https://github.com/mozilla/diversity). 123 | 124 | [homepage]: https://www.contributor-covenant.org 125 | 126 | For answers to common questions about this code of conduct, see the FAQ at 127 | https://www.contributor-covenant.org/faq. Translations are available at 128 | https://www.contributor-covenant.org/translations. 129 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /Readme.md: -------------------------------------------------------------------------------- 1 | Repository for Intune Reporting using Azure Monitor, Log Analytics and Azure Workbooks 2 | 3 | -------------------------------------------------------------------------------- /Scripts/Invoke-BIOSDataCollectionToLA.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Collect OEM BIOS verson information from HP, Dell and Lenovo based on querying Log Analytics for excisting models in your environment. 4 | 5 | .DESCRIPTION 6 | Collect OEM BIOS verson information from HP, Dell and Lenovo based on querying Log Analytics for excisting models in your environment. 7 | This script is to run in Azure Automation - verfied on Powershell 5.1 and Powershell 7.1 8 | 9 | .NOTES 10 | Purpose/Change: Initial script development 11 | Author: Jan Ketil Skanke & Maurice Daly 12 | Contact: @JankeSkanke @Modaly_IT 13 | Created: 2020-10-11 14 | Updated: 2021-09-08 15 | Version history: 16 | 1.0.0 - (2021-Nov-3) Initial version 17 | 1.0.1 - (2021-Dec-01) Fixed issue with Dell BIOS version sorting and more than one entry pr SKU in OEMs XML file and catering for older format (ex: A15) 18 | 1.0.2 - (2021-Dec-01) Fixed issue with missing HP BIOS info and improved version matching 19 | .EXAMPLE 20 | #> 21 | #Requires -Modules 7Zip4Powershell, Az.Accounts, Az.OperationalInsights 22 | #region Initialisations 23 | [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 24 | #endregion Initialisations 25 | #Region Decalarations 26 | #Define WorkspaceID 27 | $WorkspaceID = Get-AutomationVariable -Name 'WorkspaceID' 28 | $SharedKey = Get-AutomationVariable -Name 'WSSharedKey' 29 | #Define Log Analytics Workspace Subscription ID 30 | $SubscriptionID = Get-AutomationVariable -Name 'LASubscriptionID' 31 | #Define OEM BIOS information Log Name 32 | $BIOSLogType = "OEMBIOSInformation" 33 | #Define Intune Custom Inventory Log Name 34 | $InventoryLog = "DeviceInventory_CL" 35 | # DO NOT DELETE TimeStampField - IT WILL BREAK LA Injection 36 | $TimeStampField = "" 37 | #EndRegion Declarations 38 | 39 | #region functions 40 | Function New-Signature ($customerId, $sharedKey, $date, $contentLength, $method, $contentType, $resource) { 41 | $xHeaders = "x-ms-date:" + $date 42 | $stringToHash = $method + "`n" + $contentLength + "`n" + $contentType + "`n" + $xHeaders + "`n" + $resource 43 | 44 | $bytesToHash = [Text.Encoding]::UTF8.GetBytes($stringToHash) 45 | $keyBytes = [Convert]::FromBase64String($sharedKey) 46 | 47 | $sha256 = New-Object System.Security.Cryptography.HMACSHA256 48 | $sha256.Key = $keyBytes 49 | $calculatedHash = $sha256.ComputeHash($bytesToHash) 50 | $encodedHash = [Convert]::ToBase64String($calculatedHash) 51 | $authorization = 'SharedKey {0}:{1}' -f $customerId, $encodedHash 52 | return $authorization 53 | }#endfunction 54 | Function Send-LogAnalyticsData($customerId, $sharedKey, $body, $logType) { 55 | $method = "POST" 56 | $contentType = "application/json" 57 | $resource = "/api/logs" 58 | $rfc1123date = [DateTime]::UtcNow.ToString("r") 59 | $contentLength = $body.Length 60 | $signature = New-Signature ` 61 | -customerId $customerId ` 62 | -sharedKey $sharedKey ` 63 | -date $rfc1123date ` 64 | -contentLength $contentLength ` 65 | -method $method ` 66 | -contentType $contentType ` 67 | -resource $resource 68 | 69 | $uri = "https://" + $customerId + ".ods.opinsights.azure.com" + $resource + "?api-version=2016-04-01" 70 | 71 | #validate that payload data does not exceed limits 72 | if ($body.Length -gt (31.9 *1024*1024)) 73 | { 74 | throw("Upload payload is too big and exceed the 32Mb limit for a single upload. Please reduce the payload size. Current payload size is: " + ($body.Length/1024/1024).ToString("#.#") + "Mb") 75 | } 76 | 77 | $payloadsize = ("Upload payload size is " + ($body.Length/1024).ToString("#.#") + "Kb ") 78 | 79 | $headers = @{ 80 | "Authorization" = $signature; 81 | "Log-Type" = $logType; 82 | "x-ms-date" = $rfc1123date; 83 | "time-generated-field" = $TimeStampField; 84 | } 85 | $response = Invoke-WebRequest -Uri $uri -Method $method -ContentType $contentType -Headers $headers -Body $body -UseBasicParsing 86 | $statusmessage = "$($response.StatusCode) : $($payloadsize)" 87 | return $statusmessage 88 | }#endfunction 89 | function Get-XMLData ($XMLUrl) { 90 | $xml = New-Object xml 91 | $resolver = New-Object -TypeName System.Xml.XmlUrlResolver 92 | $resolver.Credentials = [System.Net.CredentialCache]::DefaultCredentials 93 | $reader = New-Object -TypeName System.Xml.XmlReaderSettings 94 | $reader.XmlResolver = $resolver 95 | $reader = [System.Xml.XmlReader]::Create($XMLUrl, $reader) 96 | $xml.Load($reader) 97 | [xml]$response = $xml 98 | return $response 99 | }#endfunction 100 | #endregion functions 101 | 102 | #region script 103 | #Connecting Using Managed Service Identity with defined subscription 104 | $Connecting = Connect-AzAccount -Identity -Subscription $SubscriptionID 105 | 106 | #region Dell 107 | #Query Log Analytics for models in Intune Inventory 108 | $DellSystemSKUsQuery = "$($InventoryLog) | where Manufacturer_s contains `"Dell`" | distinct SystemSKU_s" 109 | $DellSystemSKUs = Invoke-AZOperationalInsightsQuery -WorkspaceId $WorkspaceID -Query $DellSystemSKUsQuery 110 | #Query OEM, Process and inject to LA 111 | Invoke-WebRequest -Uri "https://downloads.dell.com/catalog/CatalogPC.cab" -OutFile (Join-Path -Path $env:TEMP -ChildPath "CatalogPC.cab") 112 | if (Test-Path -Path (Join-Path -Path $env:TEMP -ChildPath "CatalogPC.xml")){ 113 | Remove-Item (Join-Path -Path $env:TEMP -ChildPath "CatalogPC.xml") 114 | } 115 | Expand-7Zip -ArchiveFileName (Join-Path -Path $env:TEMP -ChildPath "CatalogPC.cab") -TargetPath $env:TEMP 116 | [xml]$DellBIOSXML = Get-Content -Path (Join-Path -Path $env:TEMP -ChildPath "CatalogPC.xml") 117 | foreach($SKU in $DellSystemSKUs.Results.SystemSKU_s){ 118 | if (-not([string]::IsNullOrEmpty($Sku))){ 119 | $AllBIOSVersions = ($DellBiosXML.Manifest.SoftwareComponent | Where-Object {($_.name.display."#cdata-section" -match "BIOS") -and ($_.SupportedSystems.Brand.Model.SystemID -match $SKU)}).vendorVersion 120 | Write-Verbose "Testing $($AllBIOSVersions) on $($SKU)" 121 | $VersionBIOSVersion = @() 122 | if ($AllBIOSVersions -match "[a-zA-Z][0-9]{2}"){ 123 | Write-Verbose "Using older BIOS version format $($AllBIOSVersions)" 124 | $DellBIOSLatest = $DellBiosXML.Manifest.SoftwareComponent | Where-Object {($_.name.display."#cdata-section" -match "BIOS") -and ($_.SupportedSystems.Brand.Model.SystemID -match $SKU)} | Sort-Object -Property vendorVersion -Descending | Select-Object -First 1 125 | } 126 | else { 127 | foreach ($BIOSVersion in $AllBIOSVersions){ 128 | [Version]$BIOSVersion = $BIOSVersion 129 | $VersionBIOSVersion += $BIOSVersion 130 | } 131 | $VersionBIOSVersionLatest = $VersionBIOSVersion | Sort-Object -Descending | Select-Object -First 1 132 | $DellBIOSLatest = $DellBiosXML.Manifest.SoftwareComponent | Where-Object {($_.name.display."#cdata-section" -match "BIOS") -and ($_.SupportedSystems.Brand.Model.SystemID -match $SKU)} | Where-Object {[Version]$_.vendorVersion -match $VersionBIOSVersionLatest} 133 | } 134 | $CurrentDellBIOSVersion = $DellBIOSLatest.dellVersion 135 | [DateTime]$CurrentDellBIOSDate = $DellBIOSLatest.releaseDate 136 | #Write-Output "SKU:$($sku),Version:$($BiosLatest.ver),Date:$($BiosLatest.date)" 137 | $BIOSInventory = New-Object System.Object 138 | $BIOSInventory | Add-Member -MemberType NoteProperty -Name "SKU" -Value "$SKU" -Force 139 | $BIOSInventory | Add-Member -MemberType NoteProperty -Name "OEMVersion" -Value "$CurrentDellBIOSVersion" -Force 140 | $BIOSInventory | Add-Member -MemberType NoteProperty -Name "OEMDate" -Value "$CurrentDellBIOSDate" -Force 141 | $BIOSInventory | Add-Member -MemberType NoteProperty -Name "OEM" -Value "Dell" -Force 142 | $BIOSJson = $BIOSInventory | ConvertTo-Json 143 | #write-output $BIOSJson 144 | try { 145 | $ResponseBIOSInventory = Send-LogAnalyticsData -customerId $WorkspaceID -sharedKey $SharedKey -body ([System.Text.Encoding]::UTF8.GetBytes($BIOSJson)) -logType $BIOSLogType -ErrorAction Stop 146 | Write-Output "BIOS Information injected for SKU $($SKU)" 147 | } catch { 148 | $ResponseBIOSInventory = "Error Code: $($_.Exception.Response.StatusCode.value__)" 149 | $ResponseBIOSMessage = $_.Exception.Message 150 | Write-Output "Error $($ResponseBIOSInventory), Message $($ResponseBIOSMessage)" 151 | } 152 | } 153 | } 154 | #endregion Dell 155 | 156 | #region HP 157 | #Query Log Analytics for models in Intune Inventory 158 | $HPSystemSKUsQuery = "$($InventoryLog) | where Manufacturer_s contains `"HP`" or Manufacturer_s contains `"Hewlett`" | distinct SystemSKU_s" 159 | $HPSystemSKUs = Invoke-AZOperationalInsightsQuery -WorkspaceId $WorkspaceID -Query $HPSystemSKUsQuery 160 | # Fetching latest HP BIOS release info from HP 161 | foreach($SKU in $HPSystemSKUs.Results.SystemSKU_s){ 162 | if (-not([string]::IsNullOrEmpty($Sku))){ 163 | $BIOSXML = $null 164 | try{ 165 | $Request = Invoke-WebRequest -uri "https://ftp.ext.hp.com/pub/pcbios/$($SKU)/$($SKU).xml" 166 | $URLStatus = $Request.StatusCode 167 | } catch{ 168 | $URLStatus = $($_.Exception.Response.StatusCode.Value__) 169 | Write-Output "Unable to find BIOS Information from HP for SKU $($SKU) - Error $($URLStatus)" 170 | } 171 | 172 | if ($URLStatus -ne "404"){ 173 | $BIOSXML = Get-XMLData -XMLUrl "https://ftp.ext.hp.com/pub/pcbios/$($SKU)/$($SKU).xml" 174 | $AllHPBIOSVersions = $BIOSXML.BIOS.Rel 175 | 176 | $VersionHPBIOSVersion = @() 177 | foreach ($HPBIOSVersion in $AllHPBIOSVersions.ver){ 178 | [Version]$HPBIOSVersion = $HPBIOSVersion 179 | $VersionHPBIOSVersion += $HPBIOSVersion 180 | } 181 | $VersionHPBIOSVersionLatest = ($VersionHPBIOSVersion | Sort-Object -Descending | Select-Object -First 1)#.ToString() 182 | $BIOSLatest = $BIOSXML.BIOS.Rel | Where-Object {[Version]$_.Ver -match $VersionHPBIOSVersionLatest} 183 | $CurrentBIOSVersion = $BIOSLatest.ver 184 | [DateTime]$CurrentBIOSDate = $BIOSLatest.date 185 | 186 | #Write-Output "SKU:$($sku),Version:$($BiosLatest.ver),Date:$($BiosLatest.date)" 187 | $BIOSInventory = New-Object System.Object 188 | $BIOSInventory | Add-Member -MemberType NoteProperty -Name "SKU" -Value "$SKU" -Force 189 | $BIOSInventory | Add-Member -MemberType NoteProperty -Name "OEMVersion" -Value "$CurrentBIOSVersion" -Force 190 | $BIOSInventory | Add-Member -MemberType NoteProperty -Name "OEMDate" -Value "$CurrentBIOSDate" -Force 191 | $BIOSInventory | Add-Member -MemberType NoteProperty -Name "OEM" -Value "HP" -Force 192 | $BIOSJson = $BIOSInventory | ConvertTo-Json 193 | #write-output $BIOSJson 194 | } 195 | else{ 196 | $BIOSInventory = New-Object System.Object 197 | $BIOSInventory | Add-Member -MemberType NoteProperty -Name "SKU" -Value "$SKU" -Force 198 | $BIOSInventory | Add-Member -MemberType NoteProperty -Name "OEMVersion" -Value "NA" -Force 199 | $BIOSInventory | Add-Member -MemberType NoteProperty -Name "OEMDate" -Value "NA" -Force 200 | $BIOSInventory | Add-Member -MemberType NoteProperty -Name "OEM" -Value "HP" -Force 201 | $BIOSJson = $BIOSInventory | ConvertTo-Json 202 | } 203 | try { 204 | $ResponseBIOSInventory = Send-LogAnalyticsData -customerId $WorkspaceID -sharedKey $SharedKey -body ([System.Text.Encoding]::UTF8.GetBytes($BIOSJson)) -logType $BIOSLogType -ErrorAction Stop 205 | Write-Output "BIOS Information injected for SKU $($SKU)" 206 | } catch { 207 | $ResponseBIOSInventory = "Error Code: $($_.Exception.Response.StatusCode.value__)" 208 | $ResponseBIOSMessage = $_.Exception.Message 209 | Write-Output "Error $($ResponseBIOSInventory), Message $($ResponseBIOSMessage)" 210 | } 211 | } 212 | } 213 | #endregion HP 214 | 215 | #region Lenovo 216 | #Query Log Analytics for models in Intune Inventory 217 | $LenovoSystemSKUsQuery = "$($InventoryLog) | where Manufacturer_s contains `"Lenovo`" | distinct SystemSKU_s" 218 | $LenovoSystemSKUs = Invoke-AZOperationalInsightsQuery -WorkspaceId $WorkspaceID -Query $LenovoSystemSKUsQuery 219 | # Fetching latest Lenovo BIOS release info 220 | # Define Lenovo Download Sources 221 | $LenovoBiosBase = "https://download.lenovo.com/catalog/" 222 | foreach($SKU in $LenovoSystemSKUs.Results.SystemSKU_s){ 223 | if (-not([string]::IsNullOrEmpty($Sku))){ 224 | Write-Output "Trying Lenovo $SKU" 225 | try{ 226 | $Request = Invoke-WebRequest -uri ($LenovoBiosBase + "$SKU" + "_Win10.xml") 227 | $URLStatus = $Request.StatusCode 228 | } catch{ 229 | $URLStatus = $($_.Exception.Response.StatusCode.Value__) 230 | Write-Output "Unable to find BIOS Information from Lenovo for SKU $($SKU) - Error $($URLStatus)" 231 | } 232 | if ($URLStatus -ne "404"){ 233 | [xml]$ValidBIOSLocationXML = Get-XMLData -XMLUrl ($LenovoBiosBase + "$SKU" + "_Win10.xml") 234 | $LenovoModelBIOSInfo = $ValidBIOSLocationXML.Packages.Package | Where-Object {$_.Category -match "BIOS" } | Sort-Object Location -Descending | Select-Object -First 1 235 | $LenovoBIOSLocationInfo = $LenovoModelBIOSInfo.location 236 | $LatestOEMBIOSInfo = (Get-XMLData -XMLUrl $LenovoBIOSLocationInfo).Package 237 | 238 | $CurrentBIOSVersion = $LatestOEMBIOSInfo.version 239 | [DateTime]$CurrentBIOSDate = $LatestOEMBIOSInfo.ReleaseDate 240 | 241 | #Write-Output "SKU:$($sku),Version:$($BiosLatest.ver),Date:$($BiosLatest.date)" 242 | $BIOSInventory = New-Object System.Object 243 | $BIOSInventory | Add-Member -MemberType NoteProperty -Name "SKU" -Value "$SKU" -Force 244 | $BIOSInventory | Add-Member -MemberType NoteProperty -Name "OEMVersion" -Value "$CurrentBIOSVersion" -Force 245 | $BIOSInventory | Add-Member -MemberType NoteProperty -Name "OEMDate" -Value "$CurrentBIOSDate" -Force 246 | $BIOSInventory | Add-Member -MemberType NoteProperty -Name "OEM" -Value "Lenovo" -Force 247 | $BIOSJson = $BIOSInventory | ConvertTo-Json 248 | } 249 | else { 250 | $BIOSInventory = New-Object System.Object 251 | $BIOSInventory | Add-Member -MemberType NoteProperty -Name "SKU" -Value "$SKU" -Force 252 | $BIOSInventory | Add-Member -MemberType NoteProperty -Name "OEMVersion" -Value "NA" -Force 253 | $BIOSInventory | Add-Member -MemberType NoteProperty -Name "OEMDate" -Value "NA" -Force 254 | $BIOSInventory | Add-Member -MemberType NoteProperty -Name "OEM" -Value "Lenovo" -Force 255 | $BIOSJson = $BIOSInventory | ConvertTo-Json 256 | } 257 | try { 258 | $ResponseBIOSInventory = Send-LogAnalyticsData -customerId $WorkspaceID -sharedKey $SharedKey -body ([System.Text.Encoding]::UTF8.GetBytes($BIOSJson)) -logType $BIOSLogType -ErrorAction Stop 259 | Write-Output "BIOS Information injected for SKU $($SKU)" 260 | } catch { 261 | $ResponseBIOSInventory = "Error Code: $($_.Exception.Response.StatusCode.value__)" 262 | $ResponseBIOSMessage = $_.Exception.Message 263 | Write-Output "Error $($ResponseBIOSInventory), Message $($ResponseBIOSMessage)" 264 | } 265 | $ValidBIOSLocationXML = $null 266 | $URLStatus = $null 267 | } 268 | } 269 | #endregion Lenovo 270 | #endregion Script -------------------------------------------------------------------------------- /Scripts/Invoke-CustomAppReliability.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Collect custom application reliability monitor events and upload to Log Analytics for further processing. 4 | 5 | .DESCRIPTION 6 | This script will audit reliability events and upload this to a Log Analytics Workspace. This allows you to easily identify applications which are causing stability issues. 7 | The script is meant to be runned on a daily schedule either via Proactive Remediations (RECOMMENDED) in Intune or manually added as local schedule task on your Windows 10 Computer. 8 | 9 | .EXAMPLE 10 | Invoke-CustomAppReliability.ps1.ps1(Required to run as System or Administrator) 11 | 12 | .NOTES 13 | FileName: Invoke-CustomAppReliability.ps1 14 | Author: Jan Ketil Skanke / Maurice Daly 15 | Contact: @JankeSkanke / @MoDaly_IT 16 | Created: 2022-05-16 17 | Updated: 2022-05-16 18 | 19 | Version history: 20 | 1.0.0 - (2022-05-16) Script created 21 | 22 | #> 23 | #region initialize 24 | # Enable TLS 1.2 support 25 | [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 26 | # Replace with your Log Analytics Workspace ID 27 | $CustomerId = "" 28 | 29 | # Replace with your Primary Key 30 | $SharedKey = "" 31 | 32 | # You can use an optional field to specify the timestamp from the data. If the time field is not specified, Azure Monitor assumes the time is the message ingestion time 33 | # DO NOT DELETE THIS VARIABLE. Recommened keep this blank. 34 | $TimeStampField = "" 35 | 36 | #endregion initialize 37 | 38 | #region functions 39 | 40 | # Function to create the authorization signature 41 | Function New-Signature ($customerId, $sharedKey, $date, $contentLength, $method, $contentType, $resource) { 42 | $xHeaders = "x-ms-date:" + $date 43 | $stringToHash = $method + "`n" + $contentLength + "`n" + $contentType + "`n" + $xHeaders + "`n" + $resource 44 | 45 | $bytesToHash = [Text.Encoding]::UTF8.GetBytes($stringToHash) 46 | $keyBytes = [Convert]::FromBase64String($sharedKey) 47 | 48 | $sha256 = New-Object System.Security.Cryptography.HMACSHA256 49 | $sha256.Key = $keyBytes 50 | $calculatedHash = $sha256.ComputeHash($bytesToHash) 51 | $encodedHash = [Convert]::ToBase64String($calculatedHash) 52 | $authorization = 'SharedKey {0}:{1}' -f $customerId, $encodedHash 53 | return $authorization 54 | } 55 | 56 | # Function to create and post the request 57 | Function Send-LogAnalyticsData($customerId, $sharedKey, $body, $logType) { 58 | $method = "POST" 59 | $contentType = "application/json" 60 | $resource = "/api/logs" 61 | $rfc1123date = [DateTime]::UtcNow.ToString("r") 62 | $contentLength = $body.Length 63 | $signature = New-Signature ` 64 | -customerId $customerId ` 65 | -sharedKey $sharedKey ` 66 | -date $rfc1123date ` 67 | -contentLength $contentLength ` 68 | -method $method ` 69 | -contentType $contentType ` 70 | -resource $resource 71 | $uri = "https://" + $customerId + ".ods.opinsights.azure.com" + $resource + "?api-version=2016-04-01" 72 | 73 | #validate that payload data does not exceed limits 74 | if ($body.Length -gt (31.9 * 1024 * 1024)) { 75 | throw ("Upload payload is too big and exceed the 32Mb limit for a single upload. Please reduce the payload size. Current payload size is: " + ($body.Length/1024/1024).ToString("#.#") + "Mb") 76 | } 77 | 78 | $payloadsize = ("Upload payload size is " + ($body.Length/1024).ToString("#.#") + "Kb ") 79 | 80 | $headers = @{ 81 | "Authorization" = $signature; 82 | "Log-Type" = $logType; 83 | "x-ms-date" = $rfc1123date; 84 | "time-generated-field" = $TimeStampField; 85 | } 86 | 87 | $response = Invoke-WebRequest -Uri $uri -Method $method -ContentType $contentType -Headers $headers -Body $body -UseBasicParsing 88 | $statusmessage = "$($response.StatusCode) : $($payloadsize)" 89 | return $statusmessage 90 | } 91 | 92 | function Start-PowerShellSysNative { 93 | param ( 94 | [parameter(Mandatory = $false, HelpMessage = "Specify arguments that will be passed to the sysnative PowerShell process.")] 95 | [ValidateNotNull()] 96 | [string]$Arguments 97 | ) 98 | 99 | # Get the sysnative path for powershell.exe 100 | $SysNativePowerShell = Join-Path -Path ($PSHOME.ToLower().Replace("syswow64", "sysnative")) -ChildPath "powershell.exe" 101 | 102 | # Construct new ProcessStartInfo object to run scriptblock in fresh process 103 | $ProcessStartInfo = New-Object -TypeName System.Diagnostics.ProcessStartInfo 104 | $ProcessStartInfo.FileName = $SysNativePowerShell 105 | $ProcessStartInfo.Arguments = $Arguments 106 | $ProcessStartInfo.RedirectStandardOutput = $true 107 | $ProcessStartInfo.RedirectStandardError = $true 108 | $ProcessStartInfo.UseShellExecute = $false 109 | $ProcessStartInfo.WindowStyle = "Hidden" 110 | $ProcessStartInfo.CreateNoWindow = $true 111 | 112 | # Instatiate the new 64-bit process 113 | $Process = [System.Diagnostics.Process]::Start($ProcessStartInfo) 114 | 115 | # Read standard error output to determine if the 64-bit script process somehow failed 116 | $ErrorOutput = $Process.StandardError.ReadToEnd() 117 | if ($ErrorOutput) { 118 | Write-Error -Message $ErrorOutput 119 | } 120 | } #endfunction 121 | #endregion functions 122 | 123 | #region script 124 | 125 | #Get Intune DeviceID and ManagedDeviceName 126 | if (@(Get-ChildItem HKLM:SOFTWARE\Microsoft\Enrollments\ -Recurse | Where-Object { $_.PSChildName -eq 'MS DM Server' })) { 127 | $MSDMServerInfo = Get-ChildItem HKLM:SOFTWARE\Microsoft\Enrollments\ -Recurse | Where-Object { $_.PSChildName -eq 'MS DM Server' } 128 | $ManagedDeviceInfo = Get-ItemProperty -LiteralPath "Registry::$($MSDMServerInfo)" 129 | } 130 | $ManagedDeviceName = $ManagedDeviceInfo.EntDeviceName 131 | $ManagedDeviceID = $ManagedDeviceInfo.EntDMID 132 | 133 | #Get ComputerName 134 | $ComputerName = Get-ComputerInfo | Select-Object -ExpandProperty CsName 135 | 136 | #region APPRELIABILITY 137 | 138 | # Set Name of Log 139 | $LogName = "AppReliability" 140 | 141 | $ReliabilityPayload = @() 142 | $ReliabilityEvents = Get-CimInstance win32_ReliabilityRecords | Where-Object { $_.EventIdentifier -match "1000|1002" -and $_.TimeGenerated -ge (Get-Date).AddHours(-24) } 143 | 144 | 145 | foreach ($ReliabilityEvent in $ReliabilityEvents) { 146 | 147 | $ApplicationName = $ReliabilityEvent.ProductName 148 | $ReliabilityEventId = $ReliabilityEvent.EventIdentifier 149 | $ReliabilityEventType = $ReliabilityEvent.SourceName 150 | [datetime]$ReliabilityEventTime = $ReliabilityEvent.TimeGenerated 151 | 152 | $ApplicationPath = $ReliabilityEvent.InsertionStrings | Where-Object { $_ -like "*\$ApplicationName" } | Select-Object -Unique 153 | 154 | if (-not ([string]::IsNullOrEmpty($ApplicationPath)) -and (Test-Path -Path $ApplicationPath)) { 155 | $ApplicationDetails = Get-ItemProperty -Path $ApplicationPath 156 | 157 | # Get file siging details 158 | $ApplicationSigningDetails = Get-AuthenticodeSignature -FilePath $ApplicationDetails.FullName 159 | $ApplicationSigningCert = $ApplicationSigningDetails.SignerCertificate 160 | 161 | # Get application publisher details 162 | $ApplicationPublisher = $ApplicationDetails.VersionInfo | Select-Object -ExpandProperty CompanyName 163 | if ([string]::IsNullOrEmpty($ApplicationPublisher)) { 164 | $ApplicationPublisher = "Unknown" 165 | } 166 | 167 | # Get version information 168 | $ApplicationVersion = $ApplicationDetails.VersionInfo.FileVersionRaw 169 | if ([string]::IsNullOrEmpty($ApplicationVersion)) { 170 | $ApplicationVersion = "Unavailable" 171 | } 172 | 173 | # Get faulting module 174 | Write-Warning -Message "- $($ReliabilityEvent.Message)" 175 | if ($ReliabilityEvent.Message -match "module name") { 176 | $ApplicationFaultingModule = ((($ReliabilityEvent.Message.Split(",")) | Where-Object { $_ -match "Faulting module name:" }).Split(":") | Select-Object -Last 1).Trim() 177 | $ApplicationFaultingModulePath = $($ReliabilityEvent.Message).Split() | Where-Object { $_ -like "*\$ApplicationFaultingModule" } 178 | } else { 179 | $ApplicationFaultingModule = $null 180 | $ApplicationFaultingModulePath = $null 181 | } 182 | 183 | # Create JSON to Upload to Log Analytics 184 | $ReliabilityEventPayload = New-Object System.Object 185 | $ReliabilityEventPayload | Add-Member -MemberType NoteProperty -Name "ManagedDeviceName" -Value "$ManagedDeviceName" -Force 186 | $ReliabilityEventPayload | Add-Member -MemberType NoteProperty -Name "ManagedDeviceID" -Value "$ManagedDeviceID" -Force 187 | $ReliabilityEventPayload | Add-Member -MemberType NoteProperty -Name "ComputerName" -Value "$ComputerName" -Force 188 | $ReliabilityEventPayload | Add-Member -MemberType NoteProperty -Name "Application" -Value "$ApplicationName" -Force 189 | $ReliabilityEventPayload | Add-Member -MemberType NoteProperty -Name "EventType" -Value "$ReliabilityEventType" -Force 190 | $ReliabilityEventPayload | Add-Member -MemberType NoteProperty -Name "EventId" -Value "$ReliabilityEventId" -Force 191 | $ReliabilityEventPayload | Add-Member -MemberType NoteProperty -Name "ApplicationPublisher" -Value "$ApplicationPublisher" -Force 192 | $ReliabilityEventPayload | Add-Member -MemberType NoteProperty -Name "ApplicationPath" -Value "$ApplicationPath" -Force 193 | $ReliabilityEventPayload | Add-Member -MemberType NoteProperty -Name "ApplicationSignatureCert" -Value "$ApplicationSigningCert" -Force 194 | $ReliabilityEventPayload | Add-Member -MemberType NoteProperty -Name "ApplicationVersion" -Value "$ApplicationVersion" -Force 195 | $ReliabilityEventPayload | Add-Member -MemberType NoteProperty -Name "FaultingModule" -Value "$ApplicationFaultingModule" -Force 196 | $ReliabilityEventPayload | Add-Member -MemberType NoteProperty -Name "FaultingModulePath" -Value "$ApplicationFaultingModulePath" -Force 197 | $ReliabilityEventPayload | Add-Member -MemberType NoteProperty -Name "EventGenerated" -Value "$ReliabilityEventTime" -Force 198 | 199 | # Add event to array 200 | $ReliabilityPayload += $ReliabilityEventPayload 201 | } 202 | } 203 | 204 | if ($ReliabilityEventPayload.Count -ge 1) { 205 | 206 | # Convert array data to JSON format 207 | $ReliabilityJson = $ReliabilityEventPayload | ConvertTo-Json 208 | 209 | # Submit the data to the API endpoint 210 | $ResponseAppReliability = Send-LogAnalyticsData -customerId $customerId -sharedKey $sharedKey -body ([System.Text.Encoding]::UTF8.GetBytes($ReliabilityJson)) -logType $LogName 211 | } 212 | 213 | #endregion APPRELIABILITY 214 | 215 | #Report back status 216 | $date = Get-Date -Format "dd-MM HH:mm" 217 | $OutputMessage = "InventoryDate:$date " 218 | 219 | if ($ReliabilityEventPayload.Count -ge 1) { 220 | if ($ResponseAppReliability -match "200 :") { 221 | 222 | $OutputMessage = $OutPutMessage + "AppReliability:OK " + $ResponseAppReliability 223 | } else { 224 | $OutputMessage = $OutPutMessage + "AppReliability:Fail " 225 | } 226 | } else { 227 | $OutputMessage = "" 228 | } 229 | 230 | Write-Output $OutputMessage 231 | Exit 0 232 | 233 | #endregion script 234 | -------------------------------------------------------------------------------- /Scripts/Invoke-CustomAppReliabilityWithAPI.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Collect application reliability and upload to Log Analytics for further processing. 4 | 5 | .DESCRIPTION 6 | This script will audit reliability events and upload this to a Log Analytics Workspace. This allows you to easily search in device hardware and installed apps inventory. 7 | The script is meant to be runned on a daily schedule either via Proactive Remediations (RECOMMENDED) in Intune or manually added as local schedule task on your Windows 10 Computer. 8 | 9 | .EXAMPLE 10 | Invoke-CustomAppReliabilityWithAPI.ps1 (Required to run as System or Administrator) 11 | 12 | .NOTES 13 | FileName: Invoke-CustomAppReliabilityWithAPI.ps1 14 | Author: Maurice Daly 15 | Contributor: Jan Ketil Skanke / Sandy Zeng 16 | Contact: @modaly_it 17 | Created: 2022-01-05 18 | Updated: 2022-20-05 19 | 20 | Version history: 21 | 1.0.0 - (2022 - 01 - 05) Script created 22 | #> 23 | 24 | #region initialize 25 | # Define your azure function URL: 26 | # Example 'https://.azurewebsites.net/api/' 27 | 28 | $AzureFunctionURL = "https:///api/LogCollectorAPI" 29 | 30 | # Enable TLS 1.2 support 31 | [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 32 | #Set Log Analytics Log Name 33 | $AppReliabilityLogName = "AppReliability" 34 | $Date = (Get-Date) 35 | #endregion initialize 36 | 37 | #region functions 38 | # Function to get Azure AD DeviceID 39 | function Get-AzureADDeviceID { 40 | <# 41 | .SYNOPSIS 42 | Get the Azure AD device ID from the local device. 43 | 44 | .DESCRIPTION 45 | Get the Azure AD device ID from the local device. 46 | 47 | .NOTES 48 | Author: Nickolaj Andersen 49 | Contact: @NickolajA 50 | Created: 2021-05-26 51 | Updated: 2021-05-26 52 | 53 | Version history: 54 | 1.0.0 - (2021-05-26) Function created 55 | #> 56 | Process { 57 | # Define Cloud Domain Join information registry path 58 | $AzureADJoinInfoRegistryKeyPath = "HKLM:\SYSTEM\CurrentControlSet\Control\CloudDomainJoin\JoinInfo" 59 | 60 | # Retrieve the child key name that is the thumbprint of the machine certificate containing the device identifier guid 61 | $AzureADJoinInfoThumbprint = Get-ChildItem -Path $AzureADJoinInfoRegistryKeyPath | Select-Object -ExpandProperty "PSChildName" 62 | if ($AzureADJoinInfoThumbprint -ne $null) { 63 | # Retrieve the machine certificate based on thumbprint from registry key 64 | $AzureADJoinCertificate = Get-ChildItem -Path "Cert:\LocalMachine\My" -Recurse | Where-Object { $PSItem.Thumbprint -eq $AzureADJoinInfoThumbprint } 65 | if ($AzureADJoinCertificate -ne $null) { 66 | # Determine the device identifier from the subject name 67 | $AzureADDeviceID = ($AzureADJoinCertificate | Select-Object -ExpandProperty "Subject") -replace "CN=", "" 68 | # Handle return value 69 | return $AzureADDeviceID 70 | } 71 | } 72 | } 73 | } #endfunction 74 | function Get-AzureADJoinDate { 75 | <# 76 | .SYNOPSIS 77 | Get the Azure AD device ID from the local device. 78 | 79 | .DESCRIPTION 80 | Get the Azure AD device ID from the local device. 81 | 82 | .NOTES 83 | Author: Nickolaj Andersen 84 | Contact: @NickolajA 85 | Created: 2021-05-26 86 | Updated: 2021-05-26 87 | 88 | Version history: 89 | 1.0.0 - (2021-05-26) Function created 90 | #> 91 | Process { 92 | # Define Cloud Domain Join information registry path 93 | $AzureADJoinInfoRegistryKeyPath = "HKLM:\SYSTEM\CurrentControlSet\Control\CloudDomainJoin\JoinInfo" 94 | 95 | # Retrieve the child key name that is the thumbprint of the machine certificate containing the device identifier guid 96 | $AzureADJoinInfoThumbprint = Get-ChildItem -Path $AzureADJoinInfoRegistryKeyPath | Select-Object -ExpandProperty "PSChildName" 97 | if ($AzureADJoinInfoThumbprint -ne $null) { 98 | # Retrieve the machine certificate based on thumbprint from registry key 99 | $AzureADJoinCertificate = Get-ChildItem -Path "Cert:\LocalMachine\My" -Recurse | Where-Object { $PSItem.Thumbprint -eq $AzureADJoinInfoThumbprint } 100 | if ($AzureADJoinCertificate -ne $null) { 101 | # Determine the device identifier from the subject name 102 | $AzureADJoinDate = ($AzureADJoinCertificate | Select-Object -ExpandProperty "NotBefore") 103 | # Handle return value 104 | return $AzureADJoinDate 105 | } 106 | } 107 | } 108 | } #endfunction 109 | #Function to get AzureAD TenantID 110 | function Get-AzureADTenantID { 111 | # Cloud Join information registry path 112 | $AzureADTenantInfoRegistryKeyPath = "HKLM:\SYSTEM\CurrentControlSet\Control\CloudDomainJoin\TenantInfo" 113 | # Retrieve the child key name that is the tenant id for AzureAD 114 | $AzureADTenantID = Get-ChildItem -Path $AzureADTenantInfoRegistryKeyPath | Select-Object -ExpandProperty "PSChildName" 115 | return $AzureADTenantID 116 | } 117 | # Function to get all Installed Application 118 | function Get-InstalledApplications() { 119 | param ( 120 | [string]$UserSid 121 | ) 122 | 123 | New-PSDrive -PSProvider Registry -Name "HKU" -Root HKEY_USERS | Out-Null 124 | $regpath = @("HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*") 125 | $regpath += "HKU:\$UserSid\Software\Microsoft\Windows\CurrentVersion\Uninstall\*" 126 | if (-not ([IntPtr]::Size -eq 4)) { 127 | $regpath += "HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*" 128 | $regpath += "HKU:\$UserSid\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*" 129 | } 130 | $propertyNames = 'DisplayName', 'DisplayVersion', 'Publisher', 'UninstallString' 131 | $Apps = Get-ItemProperty $regpath -Name $propertyNames -ErrorAction SilentlyContinue | . { process { if ($_.DisplayName) { $_ } } } | Select-Object DisplayName, DisplayVersion, Publisher, UninstallString, PSPath | Sort-Object DisplayName 132 | Remove-PSDrive -Name "HKU" | Out-Null 133 | Return $Apps 134 | } 135 | #endregion functions 136 | 137 | #region script 138 | 139 | #Get Common data for App and Device Inventory: 140 | #Get Intune DeviceID and ManagedDeviceName 141 | if (@(Get-ChildItem HKLM:SOFTWARE\Microsoft\Enrollments\ -Recurse | Where-Object { $_.PSChildName -eq 'MS DM Server' })) { 142 | $MSDMServerInfo = Get-ChildItem HKLM:SOFTWARE\Microsoft\Enrollments\ -Recurse -ErrorAction SilentlyContinue | Where-Object { $_.PSChildName -eq 'MS DM Server' } 143 | $ManagedDeviceInfo = Get-ItemProperty -LiteralPath "Registry::$($MSDMServerInfo)" -ErrorAction SilentlyContinue 144 | } 145 | $ManagedDeviceName = $ManagedDeviceInfo.EntDeviceName 146 | $ManagedDeviceID = $ManagedDeviceInfo.EntDMID 147 | $AzureADDeviceID = Get-AzureADDeviceID 148 | $AzureADTenantID = Get-AzureADTenantID 149 | 150 | #Get Computer Info 151 | $ComputerInfo = Get-CimInstance -ClassName Win32_ComputerSystem 152 | $ComputerName = $ComputerInfo.Name 153 | $ComputerManufacturer = $ComputerInfo.Manufacturer 154 | 155 | # Collect log flag 156 | $CollectAppReliability = $true 157 | 158 | if ($ComputerManufacturer -match "HP|Hewlett-Packard") { 159 | $ComputerManufacturer = "HP" 160 | } 161 | 162 | #region APPRELIABILITY 163 | if ($CollectAppReliability) { 164 | # Obtain reliability data 165 | $AppReliabilityInventory = @() 166 | $ReliabilityEvents = Get-CimInstance win32_ReliabilityRecords | Where-Object { $_.EventIdentifier -match "1000|1002" -and $_.TimeGenerated -ge (Get-Date).AddHours(-24) } 167 | 168 | # Loop and process reliability events 169 | foreach ($ReliabilityEvent in $ReliabilityEvents) { 170 | 171 | $ApplicationName = $ReliabilityEvent.ProductName 172 | $ReliabilityEventId = $ReliabilityEvent.EventIdentifier 173 | $ReliabilityEventType = $ReliabilityEvent.SourceName 174 | [datetime]$ReliabilityEventTime = $ReliabilityEvent.TimeGenerated 175 | 176 | $ApplicationPath = $ReliabilityEvent.InsertionStrings | Where-Object { $_ -like "*\$ApplicationName" } | Select-Object -Unique 177 | 178 | if (-not ([string]::IsNullOrEmpty($ApplicationPath)) -and (Test-Path -Path $ApplicationPath)) { 179 | $ApplicationDetails = Get-ItemProperty -Path $ApplicationPath 180 | 181 | # Get file siging details 182 | $ApplicationSigningDetails = Get-AuthenticodeSignature -FilePath $ApplicationDetails.FullName 183 | $ApplicationSigningCert = $ApplicationSigningDetails.SignerCertificate 184 | 185 | # Get application publisher details 186 | $ApplicationPublisher = $ApplicationDetails.VersionInfo | Select-Object -ExpandProperty CompanyName 187 | if ([string]::IsNullOrEmpty($ApplicationPublisher)) { 188 | $ApplicationPublisher = "Unknown" 189 | } 190 | 191 | # Get version information 192 | $ApplicationVersion = $ApplicationDetails.VersionInfo.FileVersionRaw 193 | if ([string]::IsNullOrEmpty($ApplicationVersion)) { 194 | $ApplicationVersion = "Unavailable" 195 | } 196 | 197 | # Get faulting module 198 | if ($ReliabilityEvent.Message -match "module name") { 199 | $ApplicationFaultingModule = ((($ReliabilityEvent.Message.Split(",")) | Where-Object { $_ -match "Faulting module name:" }).Split(":") | Select-Object -Last 1).Trim() 200 | $ApplicationFaultingModulePath = $($ReliabilityEvent.Message).Split() | Where-Object { $_ -like "*\$ApplicationFaultingModule" } 201 | } else { 202 | $ApplicationFaultingModule = $null 203 | $ApplicationFaultingModulePath = $null 204 | } 205 | 206 | # Create JSON to Upload to Log Analytics 207 | $ReliabilityEventPayload = New-Object System.Object 208 | $ReliabilityEventPayload | Add-Member -MemberType NoteProperty -Name "ManagedDeviceName" -Value "$ManagedDeviceName" -Force 209 | $ReliabilityEventPayload | Add-Member -MemberType NoteProperty -Name "ManagedDeviceID" -Value "$ManagedDeviceID" -Force 210 | $ReliabilityEventPayload | Add-Member -MemberType NoteProperty -Name "ComputerName" -Value "$ComputerName" -Force 211 | $ReliabilityEventPayload | Add-Member -MemberType NoteProperty -Name "Application" -Value "$ApplicationName" -Force 212 | $ReliabilityEventPayload | Add-Member -MemberType NoteProperty -Name "EventType" -Value "$ReliabilityEventType" -Force 213 | $ReliabilityEventPayload | Add-Member -MemberType NoteProperty -Name "EventId" -Value "$ReliabilityEventId" -Force 214 | $ReliabilityEventPayload | Add-Member -MemberType NoteProperty -Name "ApplicationPublisher" -Value "$ApplicationPublisher" -Force 215 | $ReliabilityEventPayload | Add-Member -MemberType NoteProperty -Name "ApplicationPath" -Value "$ApplicationPath" -Force 216 | $ReliabilityEventPayload | Add-Member -MemberType NoteProperty -Name "ApplicationSignatureCert" -Value "$ApplicationSigningCert" -Force 217 | $ReliabilityEventPayload | Add-Member -MemberType NoteProperty -Name "ApplicationVersion" -Value "$ApplicationVersion" -Force 218 | $ReliabilityEventPayload | Add-Member -MemberType NoteProperty -Name "FaultingModule" -Value "$ApplicationFaultingModule" -Force 219 | $ReliabilityEventPayload | Add-Member -MemberType NoteProperty -Name "FaultingModulePath" -Value "$ApplicationFaultingModulePath" -Force 220 | $ReliabilityEventPayload | Add-Member -MemberType NoteProperty -Name "EventGenerated" -Value "$ReliabilityEventTime" -Force 221 | 222 | # Add event to array 223 | $AppReliabilityInventory += $ReliabilityEventPayload 224 | } 225 | } 226 | } 227 | 228 | #endregion APPRELIABILITY 229 | 230 | #Randomize over 50 minutes to spread load on Azure Function - disabled on date of enrollment 231 | $JoinDate = Get-AzureADJoinDate 232 | $DelayDate = $JoinDate.AddDays(1) 233 | $CompareDate = ($DelayDate - $JoinDate) 234 | if ($CompareDate.Days -ge 1) { 235 | Write-Output "Randomzing execution time" 236 | #$ExecuteInSeconds = (Get-Random -Maximum 3000 -Minimum 1) 237 | #Start-Sleep -Seconds $ExecuteInSeconds 238 | } 239 | #Start sending logs 240 | $date = Get-Date -Format "dd-MM HH:mm" 241 | $OutputMessage = "InventoryDate:$date " 242 | 243 | $headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]" 244 | $headers.Add("Content-Type", "application/json") 245 | 246 | $LogPayLoad = New-Object -TypeName PSObject 247 | $LogPayLoad | Add-Member -NotePropertyMembers @{ $AppReliabilityLogName = $AppReliabilityInventory } 248 | 249 | # Construct main payload to send to LogCollectorAPI 250 | $MainPayLoad = [PSCustomObject]@{ 251 | AzureADTenantID = $AzureADTenantID 252 | AzureADDeviceID = $AzureADDeviceID 253 | LogPayloads = $LogPayLoad 254 | } 255 | 256 | $MainPayLoadJson = $MainPayLoad | ConvertTo-Json -Depth 9 257 | 258 | # Sending data to API 259 | try { 260 | $ResponseInventory = Invoke-RestMethod $AzureFunctionURL -Method 'POST' -Headers $headers -Body $MainPayLoadJson 261 | $OutputMessage = $OutPutMessage + "Inventory:OK " + $ResponseInventory 262 | } catch { 263 | $ResponseInventory = "Error Code: $($_.Exception.Response.StatusCode.value__)" 264 | $ResponseMessage = $_.Exception.Message 265 | $OutputMessage = $OutPutMessage + "Inventory:Fail " + $ResponseInventory + $ResponseMessage 266 | } 267 | 268 | # Check status and report to Proactive Remediations 269 | if ($ResponseInventory -match "200") { 270 | $AppReliabilityResponse = $ResponseInventory.Split(",") | Where-Object { $_ -match "AppReliability:" } 271 | if ($AppReliabilityResponse -match "AppReliability:200") { 272 | $OutputMessage = $OutPutMessage + " AppReliability:OK " + $AppReliabilityResponse 273 | } else { 274 | $OutputMessage = $OutPutMessage + " AppReliability:Fail " + $AppReliabilityResponse 275 | } 276 | Write-Output $OutputMessage 277 | if ($AppReliabilityResponse -notmatch "AppReliability:200") { 278 | Exit 1 279 | } else { 280 | Exit 0 281 | } 282 | } else { 283 | Write-Output "Error: $($ResponseInventory), Message: $($ResponseMessage)" 284 | Exit 1 285 | } 286 | #endregion script 287 | -------------------------------------------------------------------------------- /Scripts/Invoke-DeliveryOptimizationDataGatherScript.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Collects Delivery Optimization settings and uploads to Log Analytics for further processing. 4 | 5 | .DESCRIPTION 6 | This script will collect Delivery Optimization settings from the local device and upload the data to an Azure Function for further processing. The script will check if the device is running a supported operating system version and if the Delivery Optimization registry key exists. If the registry key does not exist, the script will create the registry key and value. The script will then restart the Delivery Optimization service and exit with an exit code of 0 if successful. 7 | 8 | .EXAMPLE 9 | Invoke-DeliveryOptimizationDataGather.ps1 (Required to run as System or Administrator) 10 | 11 | .PARAMETER 12 | Note the following variables 13 | $RandomiseCollectionInt - if this is true the randomizer to spread load over X minutes is enabled 14 | $RandomizeMinutes - the number of minutes to randomize load over. Max 50 minutes to avoid PR timeouts 15 | 16 | .NOTES 17 | FileName: Invoke-DeliveryOptimizationDataGather.ps1 18 | Author: Maurice Daly 19 | Contributor: Sandy Zeng / Jan Ketil Skanke 20 | Contact: @MoDaly_IT 21 | Created: 30-05-2024 22 | Updated: 30-05-2024 by @modaly_it 23 | 24 | Version history: 25 | 1.0.0 - (30-05-2024) Script created 26 | 1.0.1 - (30-05-2024) Script updates 27 | 1.0.2 - (30-05-2024) Script updates 28 | #> 29 | 30 | #region initialize 31 | # Define your azure function URL: 32 | # Example 'https://.azurewebsites.net/api/' 33 | 34 | $AzureFunctionURL = "YOURFUNCTIONURLHERE" 35 | 36 | # Enable TLS 1.2 support 37 | [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 38 | 39 | #Control if you want to collect (True = Collect) 40 | $CollectDORegistrySettings = $true 41 | $CollectDOPerfStats = $true 42 | $CollectDOConfig = $true 43 | $CollectDOMonthlyPerfStats = $true 44 | $CollectDOContentStats = $false 45 | 46 | #Set Log Analytics Log Name 47 | $DORegistryLog = "DeliveryOptimizationSettings" 48 | $DORegistryStatsLog = "DeliveryOptimizationPerfStats" 49 | $DORegistryMonthlyStatsLog = "DeliveryOptimizationMonthlyPerfStats" 50 | $DOConfigLog = "DeliveryOptimizationConfig" 51 | $DOContentStatsLog = "DeliveryOptimizationContentStats" 52 | 53 | $Date = (Get-Date) 54 | # Enable or disable randomized running time to avoid azure function to be overloaded in larger environments 55 | # Set to true only if needed 56 | $RandomiseCollectionInt = $false 57 | # Time to randomize over, max 50 minutes to avoid PR timeout. 58 | $RandomizeMinutes = 30 59 | 60 | #endregion initialize 61 | 62 | #region functions 63 | # Function to get Azure AD DeviceID 64 | function Get-AzureADDeviceID { 65 | <# 66 | .SYNOPSIS 67 | Get the Azure AD device ID from the local device. 68 | 69 | .DESCRIPTION 70 | Get the Azure AD device ID from the local device. 71 | 72 | .NOTES 73 | Author: Nickolaj Andersen 74 | Contact: @NickolajA 75 | Created: 2021-05-26 76 | Updated: 2021-05-26 77 | 78 | Version history: 79 | 1.0.0 - (2021-05-26) Function created 80 | 1.0.1 - (2022-15.09) Updated to support CloudPC (Different method to find AzureAD DeviceID) 81 | #> 82 | Process { 83 | # Define Cloud Domain Join information registry path 84 | $AzureADJoinInfoRegistryKeyPath = "HKLM:\SYSTEM\CurrentControlSet\Control\CloudDomainJoin\JoinInfo" 85 | 86 | # Retrieve the child key name that is the thumbprint of the machine certificate containing the device identifier guid 87 | $AzureADJoinInfoKey = Get-ChildItem -Path $AzureADJoinInfoRegistryKeyPath | Select-Object -ExpandProperty "PSChildName" 88 | if ($AzureADJoinInfoKey -ne $null) { 89 | # Retrieve the machine certificate based on thumbprint from registry key 90 | 91 | if ($AzureADJoinInfoKey -ne $null) { 92 | # Match key data against GUID regex 93 | if ([guid]::TryParse($AzureADJoinInfoKey, $([ref][guid]::Empty))) { 94 | $AzureADJoinCertificate = Get-ChildItem -Path "Cert:\LocalMachine\My" -Recurse | Where-Object { $PSItem.Subject -like "CN=$($AzureADJoinInfoKey)" } 95 | } 96 | else { 97 | $AzureADJoinCertificate = Get-ChildItem -Path "Cert:\LocalMachine\My" -Recurse | Where-Object { $PSItem.Thumbprint -eq $AzureADJoinInfoKey } 98 | } 99 | } 100 | if ($AzureADJoinCertificate -ne $null) { 101 | # Determine the device identifier from the subject name 102 | $AzureADDeviceID = ($AzureADJoinCertificate | Select-Object -ExpandProperty "Subject") -replace "CN=", "" 103 | # Handle return value 104 | return $AzureADDeviceID 105 | } 106 | } 107 | } 108 | } #endfunction 109 | function Get-AzureADJoinDate { 110 | <# 111 | .SYNOPSIS 112 | Get the Azure AD Join Date from the local device. 113 | 114 | .DESCRIPTION 115 | Get the Azure AD Join Date from the local device. 116 | 117 | .NOTES 118 | Author: Jan Ketil Skanke (and Nickolaj Andersen) 119 | Contact: @JankeSkanke 120 | Created: 2021-05-26 121 | Updated: 2021-05-26 122 | 123 | Version history: 124 | 1.0.0 - (2021-05-26) Function created 125 | 1.0.1 - (2022-15.09) Updated to support CloudPC (Different method to find AzureAD DeviceID) 126 | #> 127 | Process { 128 | # Define Cloud Domain Join information registry path 129 | $AzureADJoinInfoRegistryKeyPath = "HKLM:\SYSTEM\CurrentControlSet\Control\CloudDomainJoin\JoinInfo" 130 | 131 | # Retrieve the child key name that is the thumbprint of the machine certificate containing the device identifier guid 132 | $AzureADJoinInfoKey = Get-ChildItem -Path $AzureADJoinInfoRegistryKeyPath | Select-Object -ExpandProperty "PSChildName" 133 | if ($AzureADJoinInfoKey -ne $null) { 134 | # Retrieve the machine certificate based on thumbprint from registry key 135 | 136 | if ($AzureADJoinInfoKey -ne $null) { 137 | # Match key data against GUID regex 138 | if ([guid]::TryParse($AzureADJoinInfoKey, $([ref][guid]::Empty))) { 139 | $AzureADJoinCertificate = Get-ChildItem -Path "Cert:\LocalMachine\My" -Recurse | Where-Object { $PSItem.Subject -like "CN=$($AzureADJoinInfoKey)" } 140 | } 141 | else { 142 | $AzureADJoinCertificate = Get-ChildItem -Path "Cert:\LocalMachine\My" -Recurse | Where-Object { $PSItem.Thumbprint -eq $AzureADJoinInfoKey } 143 | } 144 | } 145 | if ($AzureADJoinCertificate -ne $null) { 146 | # Determine the device identifier from the subject name 147 | $AzureADJoinDate = ($AzureADJoinCertificate | Select-Object -ExpandProperty "NotBefore") 148 | # Handle return value 149 | return $AzureADJoinDate 150 | } 151 | } 152 | } 153 | } #endfunction 154 | #Function to get AzureAD TenantID 155 | function Get-AzureADTenantID { 156 | # Cloud Join information registry path 157 | $AzureADTenantInfoRegistryKeyPath = "HKLM:\SYSTEM\CurrentControlSet\Control\CloudDomainJoin\TenantInfo" 158 | # Retrieve the child key name that is the tenant id for AzureAD 159 | $AzureADTenantID = Get-ChildItem -Path $AzureADTenantInfoRegistryKeyPath | Select-Object -ExpandProperty "PSChildName" 160 | return $AzureADTenantID 161 | } 162 | #endregion functions 163 | 164 | #region script 165 | #region common 166 | # ***** DO NOT EDIT IN THIS REGION ***** 167 | # Check if device is in "provisioning day" and skip inventory until next day if true 168 | $JoinDate = Get-AzureADJoinDate 169 | $DelayDate = $JoinDate.AddDays(1) 170 | $CompareDate = ($Date - $DelayDate) 171 | if ($CompareDate.TotalDays -ge 0){ 172 | # Randomize over X minutes to spread load on Azure Function if enabled 173 | if ($RandomiseCollectionInt -eq $true){ 174 | Write-Output "Randomzing execution time" 175 | $RandomizerSeconds = $RandomizeMinutes * 60 176 | $ExecuteInSeconds = (Get-Random -Maximum $RandomizerSeconds -Minimum 1) 177 | Start-Sleep -Seconds $ExecuteInSeconds 178 | } 179 | } else { 180 | Write-Output "Device recently added, inventory not to be runned before $Delaydate" 181 | Exit 0 182 | } 183 | 184 | #Get Intune DeviceID and ManagedDeviceName 185 | if (@(Get-ChildItem HKLM:SOFTWARE\Microsoft\Enrollments\ -Recurse | Where-Object { $_.PSChildName -eq 'MS DM Server' })) { 186 | $MSDMServerInfo = Get-ChildItem HKLM:SOFTWARE\Microsoft\Enrollments\ -Recurse -ErrorAction SilentlyContinue | Where-Object { $_.PSChildName -eq 'MS DM Server' } 187 | $ManagedDeviceInfo = Get-ItemProperty -LiteralPath "Registry::$($MSDMServerInfo)" -ErrorAction SilentlyContinue 188 | } 189 | $ManagedDeviceName = $ManagedDeviceInfo.EntDeviceName 190 | $ManagedDeviceID = $ManagedDeviceInfo.EntDMID 191 | $AzureADDeviceID = Get-AzureADDeviceID 192 | $AzureADTenantID = Get-AzureADTenantID 193 | 194 | #Get Computer Info 195 | $ComputerInfo = Get-CimInstance -ClassName Win32_ComputerSystem 196 | $ComputerName = $ComputerInfo.Name 197 | #endregion common 198 | 199 | #region DeliveryOptimizationSettings 200 | if ($CollectDORegistrySettings) { 201 | 202 | #Get Delivery Optimization settings from registry 203 | $DOSettingsRegKey = "HKLM:\SOFTWARE\Microsoft\PolicyManager\Current\Device\DeliveryOptimization" 204 | $ExcludedProperties = "PSParentPath", "PSChildName", "PSDrive", "PSProvider", "PSPath" 205 | $DOSettingsRegSettings = Get-Item -Path $DOSettingsRegKey -ErrorAction SilentlyContinue | Get-ItemProperty -ErrorAction SilentlyContinue 206 | $DOSettings = $DOSettingsRegSettings.PSObject.Properties | Select-Object -Property Name, Value | Where-Object { $_.Name -notin $ExcludedProperties } 207 | 208 | # Create array for DO settings 209 | $DOSettingsArray = @() 210 | $DOSetting = New-Object -TypeName PSObject 211 | foreach ($Setting in $DOSettings) { 212 | try { 213 | $DOSetting | Add-Member -MemberType NoteProperty -Name "ManagedDeviceId" -Value "$ManagedDeviceId" -Force 214 | $DOSetting | Add-Member -MemberType NoteProperty -Name "ManagedDeviceName" -Value "$ComputerName" -Force 215 | $DOSetting | Add-Member -MemberType NoteProperty -Name "$($Setting.Name)" -Value "$($Setting.Value)" -Force 216 | } 217 | catch [System.Exception] { 218 | Write-Output "[Warning] - Unable to add $($App.DisplayName) to DO registry array. Error message: $($_.Exception.Message)" 219 | } 220 | } 221 | # Add to full settings array 222 | $DOSettingsArray += $DOSetting 223 | 224 | # Constuct object for reporting 225 | $DOSettingsOutput = $DOSettingsArray 226 | } 227 | #endregion DeliveryOptimizationSettings 228 | 229 | #region DeliveryOptimizationPerfStats 230 | if ($CollectDOPerfStats) { 231 | 232 | try { 233 | #Get Delivery Optimization performance stats 234 | $DOPerfSnapRawValues = Get-DeliveryOptimizationPerfSnap | Select-Object -Property * 235 | $ExcludedProperties = "PSParentPath", "PSChildName", "PSDrive", "PSProvider", "PSPath" 236 | $DOPerfSnapValues = $DOPerfSnapRawValues.PSObject.Properties | Select-Object -Property Name, Value | Where-Object { $_.Name -notin $ExcludedProperties } 237 | 238 | # Create array for DO settings 239 | $DOPerfSnapArray = @() 240 | $DOPerfSnapEntry = New-Object -TypeName PSObject 241 | foreach ($Value in $DOPerfSnapValues) { 242 | try { 243 | $DOPerfSnapEntry | Add-Member -MemberType NoteProperty -Name "ManagedDeviceId" -Value "$ManagedDeviceId" -Force 244 | $DOPerfSnapEntry | Add-Member -MemberType NoteProperty -Name "ManagedDeviceName" -Value "$ComputerName" -Force 245 | $DOPerfSnapEntry | Add-Member -MemberType NoteProperty -Name "$($Value.Name)" -Value "$($Value.Value)" -Force 246 | } 247 | catch [System.Exception] { 248 | Write-Output "[Warning] - Unable to add $($App.DisplayName) to DO performance array. Error message: $($_.Exception.Message)" 249 | } 250 | } 251 | # Add to full settings array 252 | $DOPerfSnapArray += $DOPerfSnapEntry 253 | 254 | # Constuct object for reporting 255 | $DOPerfSnapOutput = $DOPerfSnapArray 256 | } 257 | catch { 258 | Write-Output "[Warning] - Unable to get Delivery Optimization performance stats. Error message: $($_.Exception.Message)" 259 | } 260 | } 261 | #endregion DeliveryOptimizationPerfStats 262 | 263 | #region DeliveryOptimizationMonthlyPerfStats 264 | if ($CollectDOMonthlyPerfStats) { 265 | 266 | try { 267 | #Get Delivery Optimization monthly performance stats 268 | $DOMonthlyPerfSnapRawValues = Get-DeliveryOptimizationPerfSnapThisMonth | Select-Object -Property * 269 | $ExcludedProperties = "PSParentPath", "PSChildName", "PSDrive", "PSProvider", "PSPath" 270 | $DOMonthlyPerfSnapValues = $DOMonthlyPerfSnapRawValues.PSObject.Properties | Select-Object -Property Name, Value | Where-Object { $_.Name -notin $ExcludedProperties } 271 | 272 | # Create array for DO settings 273 | $DOMonthlyPerfSnapArray = @() 274 | $DOMonthlyPerfSnapEntry = New-Object -TypeName PSObject 275 | foreach ($Value in $DOMonthlyPerfSnapValues) { 276 | try { 277 | $DOMonthlyPerfSnapEntry | Add-Member -MemberType NoteProperty -Name "ManagedDeviceId" -Value "$ManagedDeviceId" -Force 278 | $DOMonthlyPerfSnapEntry | Add-Member -MemberType NoteProperty -Name "ManagedDeviceName" -Value "$ComputerName" -Force 279 | $DOMonthlyPerfSnapEntry | Add-Member -MemberType NoteProperty -Name "$($Value.Name)" -Value "$($Value.Value)" -Force 280 | } 281 | catch [System.Exception] { 282 | Write-Output "[Warning] - Unable to add $($App.DisplayName) to app array list. Error message: $($_.Exception.Message)" 283 | } 284 | } 285 | # Add to full settings array 286 | $DOMonthlyPerfSnapArray += $DOMonthlyPerfSnapEntry 287 | 288 | # Constuct object for reporting 289 | $DOMonthlyPerfSnapOutput = $DOMonthlyPerfSnapArray 290 | } 291 | catch { 292 | Write-Output "[Warning] - Unable to get Delivery Optimization performance stats. Error message: $($_.Exception.Message)" 293 | } 294 | } 295 | #endregion DeliveryOptimizationMonthlyPerfStats 296 | 297 | #region DeliveryOptimizationConfig 298 | if ($CollectDOConfig) { 299 | 300 | try { 301 | #Get Delivery Optimization performance stats 302 | $DOConfigRawValues = Get-DOConfig | Select-Object -Property * 303 | $ExcludedProperties = "PSParentPath", "PSChildName", "PSDrive", "PSProvider", "PSPath" 304 | $DOConfigValues = $DOConfigRawValues.PSObject.Properties | Select-Object -Property Name, Value | Where-Object { $_.Name -notin $ExcludedProperties } 305 | 306 | # Create array for DO settings 307 | $DOConfigArray = @() 308 | $DOConfigEntry = New-Object -TypeName PSObject 309 | foreach ($Value in $DOConfigValues) { 310 | try { 311 | $DOConfigEntry | Add-Member -MemberType NoteProperty -Name "ManagedDeviceId" -Value "$ManagedDeviceId" -Force 312 | $DOConfigEntry | Add-Member -MemberType NoteProperty -Name "ManagedDeviceName" -Value "$ComputerName" -Force 313 | $DOConfigEntry | Add-Member -MemberType NoteProperty -Name "$($Value.Name)" -Value "$($Value.Value)" -Force 314 | } 315 | catch [System.Exception] { 316 | Write-Output "[Warning] - Unable to add $($App.DisplayName) to DO config array. Error message: $($_.Exception.Message)" 317 | } 318 | } 319 | # Add to full settings array 320 | $DOConfigArray += $DOConfigEntry 321 | 322 | # Constuct object for reporting 323 | $DOConfigOutput = $DOConfigArray 324 | } 325 | catch { 326 | Write-Output "[Warning] - Unable to get Delivery Optimization configuration. Error message: $($_.Exception.Message)" 327 | } 328 | } 329 | #endregion DeliveryOptimizationConfig 330 | 331 | #region DeliveryOptimizationStats 332 | if ($CollectDOContentStats) { 333 | 334 | try { 335 | #Get Delivery Optimization performance stats 336 | $DOContentStatsRawValues = Get-DeliveryOptimizationStatus 337 | 338 | # Create array for DO settings 339 | $DOContentStatsArray = @() 340 | $DOContentStatEntry = New-Object -TypeName PSObject 341 | foreach ($Value in $DOContentStatsRawValues) { 342 | try { 343 | $DOContentStatEntry | Add-Member -MemberType NoteProperty -Name "ManagedDeviceId" -Value "$ManagedDeviceId" -Force 344 | $DOContentStatEntry | Add-Member -MemberType NoteProperty -Name "ManagedDeviceName" -Value "$ComputerName" -Force 345 | $DOContentStatEntry | Add-Member -MemberType NoteProperty -Name "FileId" -Value "$($Value.FileId)" -Force 346 | $DOContentStatEntry | Add-Member -MemberType NoteProperty -Name "Status" -Value "$($Value.Status)" -Force 347 | $DOContentStatEntry | Add-Member -MemberType NoteProperty -Name "SourceURL" -Value "$($Value.SourceURL)" -Force 348 | $DOContentStatEntry | Add-Member -MemberType NoteProperty -Name "DownloadMode" -Value "$($Value.DownloadMode)" -Force 349 | $DOContentStatEntry | Add-Member -MemberType NoteProperty -Name "CacheHost" -Value "$($Value.CacheHost)" -Force 350 | $DOContentStatEntry | Add-Member -MemberType NoteProperty -Name "NumPeers" -Value "$($Value.NumPeers)" -Force 351 | $DOContentStatEntry | Add-Member -MemberType NoteProperty -Name "ExpireOn" -Value "$($Value.ExpireOn)" -Force 352 | $DOContentStatEntry | Add-Member -MemberType NoteProperty -Name "Priority" -Value "$($Value.Priority)" -Force 353 | $DOContentStatEntry | Add-Member -MemberType NoteProperty -Name "DownloadDuration" -Value "$($Value.DownloadDuration)" -Force 354 | $DOContentStatEntry | Add-Member -MemberType NoteProperty -Name "PredefinedCallerApplication" -Value "$($Value.PredefinedCallerApplication)" -Force 355 | 356 | # Add to full settings array 357 | $DOContentStatsArray += $DOContentStatEntry 358 | } 359 | catch [System.Exception] { 360 | Write-Output "[Warning] - Unable to add $($App.DisplayName) to content stats array. Error message: $($_.Exception.Message)" 361 | } 362 | } 363 | 364 | # Constuct object for reporting 365 | $DOContentStatsOutput = $DOContentStatsArray 366 | } 367 | catch { 368 | Write-Output "[Warning] - Unable to get Delivery Optimization configuration. Error message: $($_.Exception.Message)" 369 | } 370 | } 371 | #endregion DeliveryOptimizationStats 372 | 373 | #region compose 374 | # Start composing logdata 375 | # If additional logs is collected, remember to add to main payload 376 | $date = Get-Date -Format "dd-MM HH:mm" 377 | $OutputMessage = "InventoryDate:$date " 378 | 379 | $headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]" 380 | $headers.Add("Content-Type", "application/json") 381 | 382 | # Adding every log payload into PSObject for main payload - Additional logs can be added 383 | $LogPayLoad = New-Object -TypeName PSObject 384 | if ($CollectDORegistrySettings) { 385 | $LogPayLoad | Add-Member -NotePropertyMembers @{$DORegistryLog = $DOSettingsOutput } 386 | } 387 | if ($CollectDOPerfStats) { 388 | $LogPayLoad | Add-Member -NotePropertyMembers @{$DORegistryStatsLog = $DOPerfSnapOutput } 389 | } 390 | if ($CollectDOMonthlyPerfStats) { 391 | $LogPayLoad | Add-Member -NotePropertyMembers @{$DORegistryMonthlyStatsLog = $DOMonthlyPerfSnapOutput } 392 | } 393 | if ($CollectDOConfig) { 394 | $LogPayLoad | Add-Member -NotePropertyMembers @{$DOConfigLog = $DOConfigOutput } 395 | } 396 | if ($CollectDOContentStats) { 397 | $LogPayLoad | Add-Member -NotePropertyMembers @{$DOContentStatslog = $DOContentStatsOutput } 398 | } 399 | 400 | # Construct main payload to send to LogCollectorAPI 401 | $MainPayLoad = [PSCustomObject]@{ 402 | AzureADTenantID = $AzureADTenantID 403 | AzureADDeviceID = $AzureADDeviceID 404 | LogPayloads = $LogPayLoad 405 | } 406 | $MainPayLoadJson = $MainPayLoad | ConvertTo-Json -Depth 10 407 | 408 | #endregion compose 409 | 410 | #region ingestion 411 | # NO NEED TO EDIT BELOW THIS LINE 412 | # Requires functionapp version 1.2 413 | # Set default exit code to 0 414 | $ExitCode = 0 415 | 416 | # Attempt to send data to API 417 | try { 418 | $ResponseInventory = Invoke-RestMethod $AzureFunctionURL -Method 'POST' -Headers $headers -Body $MainPayLoadJson 419 | foreach ($response in $ResponseInventory) { 420 | if ($response.response -match "200") { 421 | $OutputMessage = $OutPutMessage + "OK: $($response.logname) $($response.response) " 422 | } 423 | else { 424 | $OutputMessage = $OutPutMessage + "FAIL: $($response.logname) $($response.response) " 425 | $ExitCode = 1 426 | } 427 | } 428 | } 429 | catch { 430 | $ResponseInventory = "Error Code: $($_.Exception.Response.StatusCode.value__)" 431 | $ResponseMessage = $_.Exception.Message 432 | $OutputMessage = $OutPutMessage + "Inventory:FAIL " + $ResponseInventory + $ResponseMessage 433 | $ExitCode = 1 434 | } 435 | # Exit script with correct output and code 436 | 437 | Write-Output $OutputMessage 438 | Exit $ExitCode 439 | #endregion ingestion 440 | 441 | #endregion script -------------------------------------------------------------------------------- /Scripts/Invoke-WUInventory.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Inventory Windows Update device settings 4 | .DESCRIPTION 5 | This script is designed to be run as a Proactive Remediation. 6 | Registry keys are inventoried on the device and uploaded to Log Analytics. 7 | Admins are able visualise the Windows Update settings in force across their devices and understand if legacy settings or GPO's are having an undesirable effect on the device Windows Update experience 8 | .EXAMPLE 9 | Invoke-WUInventory.ps1 (Required to run as System or Administrator) 10 | .NOTES 11 | FileName: Invoke-WUInventory.ps1 12 | Author: Ben Whitmore 13 | Contributor: Maurice Daly 14 | Contact: @byteben 15 | Created: 2022-10-April 16 | 17 | Version history: 18 | 1.0 - (2022-04-10) Original Release 19 | #> 20 | 21 | #region SCRIPTVARIABLES 22 | 23 | #Track Script Version in Log Analytics Table 24 | $ScriptVersion = "PR003" 25 | 26 | #Log Analytics Workspace ID 27 | $CustomerID = "" 28 | 29 | #Log Analytics Workspace Primary Key 30 | $SharedKey = "" 31 | 32 | #Custom Log Name 33 | $LogType = "WUDevice_Settings" 34 | 35 | # You can use an optional field to specify the timestamp from the data. If the time field is not specified, Azure Monitor assumes the time is the message ingestion time 36 | # DO NOT DELETE THIS VARIABLE. Recommened keep this blank. 37 | $TimeStampField = "" 38 | 39 | #Create Windows Update Settings Array 40 | #Software\Policies\Microsoft\Windows\WindowsUpdate 41 | $WUSettingsArray = @() 42 | $WUSettingsArray += "AutoRestartDeadlinePeriodInDays" 43 | $WUSettingsArray += "AutoRestartNotificationSchedule" 44 | $WUSettingsArray += "AutoRestartRequiredNotificationDismissal" 45 | $WUSettingsArray += "BranchReadinessLevel" 46 | $WUSettingsArray += "DeferFeatureUpdates" 47 | $WUSettingsArray += "DeferFeatureUpdatesPeriodInDays" 48 | $WUSettingsArray += "DeferQualityUpdates" 49 | $WUSettingsArray += "DeferQualityUpdatesPeriodInDays" 50 | $WUSettingsArray += "DisableDualScan" 51 | $WUSettingsArray += "DoNotConnectToWindowsUpdateInternetLocations" 52 | $WUSettingsArray += "ElevateNonAdmins" 53 | $WUSettingsArray += "EngagedRestartDeadline" 54 | $WUSettingsArray += "EngagedRestartSnoozeSchedule" 55 | $WUSettingsArray += "EngagedRestartTransitionSchedule" 56 | $WUSettingsArray += "PauseFeatureUpdatesStartTime" 57 | $WUSettingsArray += "PauseQualityUpdatesStartTime" 58 | $WUSettingsArray += "ScheduleImminentRestartWarning" 59 | $WUSettingsArray += "ScheduleRestartWarning" 60 | $WUSettingsArray += "SetAutoRestartDeadline" 61 | $WUSettingsArray += "SetAutoRestartNotificationConfig" 62 | $WUSettingsArray += "SetAutoRestartNotificationDisable" 63 | $WUSettingsArray += "SetAutoRestartRequiredNotificationDismissal" 64 | $WUSettingsArray += "SetEDURestart" 65 | $WUSettingsArray += "SetEngagedRestartTransitionSchedule" 66 | $WUSettingsArray += "SetRestartWarningSchd" 67 | $WUSettingsArray += "WUServer" 68 | $WUSettingsArray += "WUStatusServer" 69 | 70 | #Collect Scan Source Registry Keys 71 | $WUSettingsArray += "SetPolicyDrivenUpdateSourceForDriverUpdates" 72 | $WUSettingsArray += "SetPolicyDrivenUpdateSourceForFeatureUpdates" 73 | $WUSettingsArray += "SetPolicyDrivenUpdateSourceForOtherUpdates" 74 | $WUSettingsArray += "SetPolicyDrivenUpdateSourceForQualityUpdates" 75 | 76 | #Software\Policies\Microsoft\Windows\WindowsUpdate\AU 77 | $WUAUSettingsArray = @() 78 | $WUAUSettingsArray += "AutoInstallMinorUpdates" 79 | $WUAUSettingsArray += "EnableFeaturedSoftware" 80 | $WUAUSettingsArray += "IncludeRecommendedUpdates" 81 | $WUAUSettingsArray += "NoAUAsDefaultShutdownOption" 82 | $WUAUSettingsArray += "NoAUShutdownOption" 83 | $WUAUSettingsArray += "NoAutoRebootWithLoggedOnUsers" 84 | $WUAUSettingsArray += "NoAutoUpdate" 85 | $WUAUSettingsArray += "RebootRelaunchTimeout" 86 | $WUAUSettingsArray += "RebootRelaunchTimeoutEnabled" 87 | $WUAUSettingsArray += "RebootWarningTimeout" 88 | $WUAUSettingsArray += "RebootWarningTimeoutEnabled" 89 | $WUAUSettingsArray += "RescheduleWaitTime" 90 | $WUAUSettingsArray += "RescheduleWaitTimeEnabled" 91 | 92 | #CoManagement Capabilities for WIndows Update Workload 93 | $CoMgmtArray = @(17, 19, 21, 23, 25, 27, 29, 31, 49, 51, 53, 55, 57, 59, 61, 63, 81, 83, 85, 87, 89, 91, 93, 95, 113, 115, 117, 119, 121, 123, 125, 127, 145, 147, 149, 151, 153, 155, 157, 159, 177, 179, 181, 183, 185, 187, 189, 191, 209, 211, 213, 215, 217, 219, 221, 223, 241, 243, 245, 247, 249, 251, 253, 255) 94 | 95 | #endregion 96 | 97 | #region Initialize 98 | 99 | # Enable TLS 1.2 support 100 | [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 101 | 102 | #Get Intune DeviceID and ManagedDeviceName 103 | if (@(Get-ChildItem HKLM:SOFTWARE\Microsoft\Enrollments\ -Recurse | Where-Object { $_.PSChildName -eq 'MS DM Server' })) { 104 | $MSDMServerInfo = Get-ChildItem HKLM:SOFTWARE\Microsoft\Enrollments\ -Recurse | Where-Object { $_.PSChildName -eq 'MS DM Server' } 105 | $ManagedDeviceInfo = Get-ItemProperty -LiteralPath "Registry::$($MSDMServerInfo)" 106 | } 107 | $ManagedDeviceID = $ManagedDeviceInfo.EntDMID 108 | 109 | #Get AAD DeviceID 110 | # Define Cloud Domain Join information registry path 111 | $AzureADJoinInfoRegistryKeyPath = "HKLM:\SYSTEM\CurrentControlSet\Control\CloudDomainJoin\JoinInfo" 112 | 113 | # Retrieve the child key name that is the thumbprint of the machine certificate containing the device identifier guid 114 | $AzureADJoinInfoThumbprint = Get-ChildItem -Path $AzureADJoinInfoRegistryKeyPath | Select-Object -ExpandProperty "PSChildName" 115 | if (-not ($AzureADJoinInfoThumbprint -eq $null)) { 116 | # Retrieve the machine certificate based on thumbprint from registry key 117 | $AzureADJoinCertificate = Get-ChildItem -Path "Cert:\LocalMachine\My" -Recurse | Where-Object { $PSItem.Thumbprint -eq $AzureADJoinInfoThumbprint } 118 | if (-not ($AzureADJoinCertificate -eq $null)) { 119 | # Determine the device identifier from the subject name 120 | $AzureADDeviceID = ($AzureADJoinCertificate | Select-Object -ExpandProperty "Subject") -replace "CN=", "" 121 | } 122 | } 123 | 124 | #Get Computer Name 125 | $DeviceName = (Get-CIMInstance -ClassName Win32_OperatingSystem -NameSpace root\cimv2).CSName 126 | 127 | #Get OS Information 128 | $ComputerOSVersion = (Get-CIMInstance -ClassName Win32_OperatingSystem -NameSpace root\cimv2).Version 129 | $ComputerOSBuild = (Get-CIMInstance -ClassName Win32_OperatingSystem -NameSpace root\cimv2).BuildNumber 130 | 131 | #Get Default AU Service 132 | $DefaultAUService = (New-Object -ComObject "Microsoft.Update.ServiceManager").services | Where-Object { $_.IsDefaultAUService -eq 'True' } | Select-Object -ExpandProperty Name 133 | 134 | #endregion 135 | 136 | #region Functions 137 | 138 | # Function to create the authorization signature 139 | Function New-Signature ($customerID, $SharedKey, $Date, $ContentLength, $Method, $ContentType, $Resource) { 140 | $xHeaders = "x-ms-date:" + $Date 141 | $stringToHash = $Method + "`n" + $ContentLength + "`n" + $ContentType + "`n" + $xHeaders + "`n" + $Resource 142 | 143 | $bytesToHash = [Text.Encoding]::UTF8.GetBytes($stringToHash) 144 | $keyBytes = [Convert]::FromBase64String($sharedKey) 145 | 146 | $sha256 = New-Object System.Security.Cryptography.HMACSHA256 147 | $sha256.Key = $keyBytes 148 | $calculatedHash = $sha256.ComputeHash($bytesToHash) 149 | $encodedHash = [Convert]::ToBase64String($calculatedHash) 150 | $authorization = 'SharedKey {0}:{1}' -f $customerId, $encodedHash 151 | return $authorization 152 | } 153 | 154 | # Function to create and post the request 155 | Function Send-LogAnalyticsData($CustomerID, $SharedKey, $Body, $LogType) { 156 | $Method = "POST" 157 | $ContentType = "application/json" 158 | $Resource = "/api/logs" 159 | $rfc1123date = [DateTime]::UtcNow.ToString("r") 160 | $ContentLength = $Body.Length 161 | $signature = New-Signature ` 162 | -customerId $customerId ` 163 | -sharedKey $sharedKey ` 164 | -date $rfc1123date ` 165 | -ContentLength $ContentLength ` 166 | -Method $Method ` 167 | -ContentType $ContentType ` 168 | -Resource $Resource 169 | $uri = "https://" + $CustomerID + ".ods.opinsights.azure.com" + $Resource + "?api-version=2016-04-01" 170 | 171 | #validate that payload data does not exceed limits 172 | if ($Body.Length -gt (31.9 * 1024 * 1024)) { 173 | throw ("Upload payload is too big and exceed the 32Mb limit for a single upload. Please reduce the payload size. Current payload size is: " + ($Body.Length / 1024 / 1024).ToString("#.#") + "Mb") 174 | } 175 | 176 | $PayLoadSize = ("Upload payload size is " + ($Body.Length / 1024).ToString("#.#") + "Kb ") 177 | 178 | $Headers = @{ 179 | "Authorization" = $signature; 180 | "Log-Type" = $logType; 181 | "x-ms-date" = $rfc1123date; 182 | "time-generated-field" = $TimeStampField; 183 | } 184 | 185 | $Response = Invoke-WebRequest -Uri $uri -Method $Method -ContentType $ContentType -Headers $Headers -Body $Body -UseBasicParsing 186 | $StatusMessage = "$($Response.StatusCode) : $($PayLoadSize)" 187 | return "$StatusMessage" 188 | } 189 | 190 | Function Get-RegSetting { 191 | param ( 192 | [parameter(Mandatory = $True)] 193 | [ValidateNotNullOrEmpty()] 194 | [string]$RegKey, 195 | [string]$RegSetting 196 | ) 197 | Try { 198 | $RegSettingValue = Get-ItemPropertyValue -Path $RegKey -Name $RegSetting -ErrorAction Stop 199 | If (-not ($RegSettingValue -eq $Null)) { 200 | Return $RegSettingValue 201 | } 202 | else { 203 | If ($RegSetting -in ("WUServer", "WUStatusServer")) { 204 | Return "" 205 | } 206 | else { 207 | Return 0 208 | } 209 | } 210 | } 211 | Catch { 212 | #Not returning caught errors 213 | If ($RegSetting -in ("WUServer", "WUStatusServer")) { 214 | Return "" 215 | } 216 | else { 217 | Return 0 218 | } 219 | } 220 | } 221 | 222 | #endregion 223 | 224 | #region Workspace 225 | 226 | #Build WindowsUpdate Regsitry Key Inventory 227 | $WUSettingPayloadInventory = $Null 228 | $WUSettingPayloadInventory = New-Object -TypeName PSObject 229 | 230 | #Build Device Inventory 231 | $WUSettingPayloadInventory | Add-Member -MemberType NoteProperty -Name ScriptVersion -Value $ScriptVersion -Force 232 | $WUSettingPayloadInventory | Add-Member -MemberType NoteProperty -Name DeviceName -Value $DeviceName -Force 233 | $WUSettingPayloadInventory | Add-Member -MemberType NoteProperty -Name ManagedDeviceID -Value $ManagedDeviceID -Force 234 | $WUSettingPayloadInventory | Add-Member -MemberType NoteProperty -Name AzureADDeviceID -Value $AzureADDeviceID -Force 235 | $WUSettingPayloadInventory | Add-Member -MemberType NoteProperty -Name ComputerOSVersion -Value $ComputerOSVersion -Force 236 | $WUSettingPayloadInventory | Add-Member -MemberType NoteProperty -Name ComputerOSBuild -Value $ComputerOSBuild -Force 237 | $WUSettingPayloadInventory | Add-Member -MemberType NoteProperty -Name DefaultAUService -Value $DefaultAUService -Force 238 | 239 | #Get CoManagement State and Workload 240 | $CoMgmtRegKey = "HKLM:\Software\Microsoft\CCM" 241 | $CoMgmtSetting = "CoManagementFlags" 242 | $CoMgmtValue = Get-RegSetting -RegKey $CoMgmtRegKey -RegSetting $CoMgmtSetting 243 | If ($CoMgmtValue -in $CoMgmtArray) { 244 | $WUSettingPayloadInventory | Add-Member -MemberType NoteProperty -Name CoMgmtWorkload -Value $true -Force 245 | } 246 | else { 247 | $WUSettingPayloadInventory | Add-Member -MemberType NoteProperty -Name CoMgmtWorkload -Value $false -Force 248 | } 249 | $WUSettingPayloadInventory | Add-Member -MemberType NoteProperty -Name CoMgmtValue -Value $CoMgmtValue -Force 250 | 251 | #Get Registry Values for Software\Policies\Microsoft\Windows\WindowsUpdate 252 | $WURegKey = "HKLM:Software\Policies\Microsoft\Windows\WindowsUpdate" 253 | ForEach ($WUSetting in $WUSettingsArray) { 254 | $RegValue = Get-RegSetting -RegKey $WURegKey -RegSetting $WUSetting 255 | $WUSettingPayloadInventory | Add-Member -MemberType NoteProperty -Name $WUSetting -Value $RegValue -Force 256 | } 257 | 258 | #Get Registry Values for Software\Policies\Microsoft\Windows\WindowsUpdate 259 | $WUAURegKey = "HKLM:Software\Policies\Microsoft\Windows\WindowsUpdate\AU" 260 | ForEach ($WUAUSetting in $WUAUSettingsArray) { 261 | $RegValue = Get-RegSetting -RegKey $WUAURegKey -RegSetting $WUAUSetting 262 | $WUSettingPayloadInventory | Add-Member -MemberType NoteProperty -Name $WUAUSetting -Value $RegValue -Force 263 | } 264 | 265 | #Build Payload Array 266 | $WUSettingPayload = $Null 267 | $WUSettingPayload = @() 268 | $WUSettingPayload += $WUSettingPayloadInventory 269 | 270 | #Prepare Array for Upload 271 | $PayloadJson = $WUSettingPayload | ConvertTo-Json 272 | 273 | #Write upload intent to console 274 | Write-Output "Sending Payload:" 275 | Write-Output $PayloadJson 276 | 277 | #Upload Data 278 | $ResponseWUInventory = Send-LogAnalyticsData -CustomerID $CustomerID -SharedKey $SharedKey -Body ([System.Text.Encoding]::UTF8.GetBytes($PayloadJson)) -LogType $LogType 279 | $ResponseWUInventory 280 | 281 | #Status Report 282 | $Date = Get-Date -Format "dd-MM HH:mm" 283 | $OutputMessage = "InventoryDate: $Date " 284 | 285 | if ($ResponseWUInventory) { 286 | if ($ResponseWUInventory -like "200*") { 287 | $OutputMessage = $OutputMessage + " WUInventory:OK" 288 | } 289 | else { 290 | $OutputMessage = $OutputMessage + " WUInventory:Fail" 291 | } 292 | } 293 | Write-Output $OutputMessage 294 | 295 | #endregion 296 | #> -------------------------------------------------------------------------------- /Scripts/Invoke-WUInventory_Funky.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Inventory Windows Update device settings 4 | .DESCRIPTION 5 | This script is designed to be run as a Proactive Remediation. 6 | Registry keys are inventoried on the device and uploaded to Log Analytics. 7 | Admins are able visualise the Windows Update settings in force across their devices and understand if legacy settings or GPO's are having an undesirable effect on the device Windows Update experience 8 | .EXAMPLE 9 | Invoke-WUInventory.ps1 (Required to run as System or Administrator) 10 | .NOTES 11 | FileName: Invoke-WUInventory.ps1 12 | Author: Ben Whitmore 13 | Contributor: Maurice Daly 14 | Contact: @byteben 15 | Created: 2022-10-April 16 | 17 | Version history: 18 | 1.0 - (2022-04-10) Original Release 19 | #> 20 | 21 | #region SCRIPTVARIABLES 22 | 23 | #Track Script Version in Log Analytics Table 24 | $ScriptVersion = "PR004" 25 | 26 | #FunctionAppURI for Log Upload 27 | $AzureFunctionURL = "<>" #e.g. "https://myfunctionappnamegoeshere.azurewebsites.net/api/LogCollectorAPI" 28 | 29 | #Custom Log Name 30 | $CustomLogName = "WUDevice_Settings" 31 | 32 | #Date 33 | $Date = (Get-Date) 34 | 35 | #Create Windows Update Settings Array 36 | #Software\Policies\Microsoft\Windows\WindowsUpdate 37 | $WUSettingsArray = @() 38 | $WUSettingsArray += "AutoRestartDeadlinePeriodInDays" 39 | $WUSettingsArray += "AutoRestartNotificationSchedule" 40 | $WUSettingsArray += "AutoRestartRequiredNotificationDismissal" 41 | $WUSettingsArray += "BranchReadinessLevel" 42 | $WUSettingsArray += "DeferFeatureUpdates" 43 | $WUSettingsArray += "DeferFeatureUpdatesPeriodInDays" 44 | $WUSettingsArray += "DeferQualityUpdates" 45 | $WUSettingsArray += "DeferQualityUpdatesPeriodInDays" 46 | $WUSettingsArray += "DisableDualScan" 47 | $WUSettingsArray += "DoNotConnectToWindowsUpdateInternetLocations" 48 | $WUSettingsArray += "ElevateNonAdmins" 49 | $WUSettingsArray += "EngagedRestartDeadline" 50 | $WUSettingsArray += "EngagedRestartSnoozeSchedule" 51 | $WUSettingsArray += "EngagedRestartTransitionSchedule" 52 | $WUSettingsArray += "PauseFeatureUpdatesStartTime" 53 | $WUSettingsArray += "PauseQualityUpdatesStartTime" 54 | $WUSettingsArray += "ScheduleImminentRestartWarning" 55 | $WUSettingsArray += "ScheduleRestartWarning" 56 | $WUSettingsArray += "SetAutoRestartDeadline" 57 | $WUSettingsArray += "SetAutoRestartNotificationConfig" 58 | $WUSettingsArray += "SetAutoRestartNotificationDisable" 59 | $WUSettingsArray += "SetAutoRestartRequiredNotificationDismissal" 60 | $WUSettingsArray += "SetEDURestart" 61 | $WUSettingsArray += "SetEngagedRestartTransitionSchedule" 62 | $WUSettingsArray += "SetRestartWarningSchd" 63 | $WUSettingsArray += "WUServer" 64 | $WUSettingsArray += "WUStatusServer" 65 | 66 | #Collect Scan Source Registry Keys 67 | $WUSettingsArray += "SetPolicyDrivenUpdateSourceForDriverUpdates" 68 | $WUSettingsArray += "SetPolicyDrivenUpdateSourceForFeatureUpdates" 69 | $WUSettingsArray += "SetPolicyDrivenUpdateSourceForOtherUpdates" 70 | $WUSettingsArray += "SetPolicyDrivenUpdateSourceForQualityUpdates" 71 | 72 | #Software\Policies\Microsoft\Windows\WindowsUpdate\AU 73 | $WUAUSettingsArray = @() 74 | $WUAUSettingsArray += "AutoInstallMinorUpdates" 75 | $WUAUSettingsArray += "EnableFeaturedSoftware" 76 | $WUAUSettingsArray += "IncludeRecommendedUpdates" 77 | $WUAUSettingsArray += "NoAUAsDefaultShutdownOption" 78 | $WUAUSettingsArray += "NoAUShutdownOption" 79 | $WUAUSettingsArray += "NoAutoRebootWithLoggedOnUsers" 80 | $WUAUSettingsArray += "NoAutoUpdate" 81 | $WUAUSettingsArray += "RebootRelaunchTimeout" 82 | $WUAUSettingsArray += "RebootRelaunchTimeoutEnabled" 83 | $WUAUSettingsArray += "RebootWarningTimeout" 84 | $WUAUSettingsArray += "RebootWarningTimeoutEnabled" 85 | $WUAUSettingsArray += "RescheduleWaitTime" 86 | $WUAUSettingsArray += "RescheduleWaitTimeEnabled" 87 | 88 | #CoManagement Capabilities for WIndows Update Workload 89 | $CoMgmtArray = @(17, 19, 21, 23, 25, 27, 29, 31, 49, 51, 53, 55, 57, 59, 61, 63, 81, 83, 85, 87, 89, 91, 93, 95, 113, 115, 117, 119, 121, 123, 125, 127, 145, 147, 149, 151, 153, 155, 157, 159, 177, 179, 181, 183, 185, 187, 189, 191, 209, 211, 213, 215, 217, 219, 221, 223, 241, 243, 245, 247, 249, 251, 253, 255) 90 | 91 | #endregion 92 | 93 | #region Initialize 94 | 95 | # Enable TLS 1.2 support 96 | [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 97 | 98 | #Get Intune DeviceID and ManagedDeviceName 99 | if (@(Get-ChildItem HKLM:SOFTWARE\Microsoft\Enrollments\ -Recurse | Where-Object { $_.PSChildName -eq 'MS DM Server' })) { 100 | $MSDMServerInfo = Get-ChildItem HKLM:SOFTWARE\Microsoft\Enrollments\ -Recurse | Where-Object { $_.PSChildName -eq 'MS DM Server' } 101 | $ManagedDeviceInfo = Get-ItemProperty -LiteralPath "Registry::$($MSDMServerInfo)" 102 | } 103 | $ManagedDeviceID = $ManagedDeviceInfo.EntDMID 104 | 105 | #Get AAD DeviceID 106 | # Define Cloud Domain Join information registry path 107 | $AzureADJoinInfoRegistryKeyPath = "HKLM:\SYSTEM\CurrentControlSet\Control\CloudDomainJoin\JoinInfo" 108 | 109 | # Retrieve the child key name that is the thumbprint of the machine certificate containing the device identifier guid 110 | $AzureADJoinInfoThumbprint = Get-ChildItem -Path $AzureADJoinInfoRegistryKeyPath | Select-Object -ExpandProperty "PSChildName" 111 | if (-not ($AzureADJoinInfoThumbprint -eq $null)) { 112 | # Retrieve the machine certificate based on thumbprint from registry key 113 | $AzureADJoinCertificate = Get-ChildItem -Path "Cert:\LocalMachine\My" -Recurse | Where-Object { $PSItem.Thumbprint -eq $AzureADJoinInfoThumbprint } 114 | if (-not ($AzureADJoinCertificate -eq $null)) { 115 | # Determine the device identifier from the subject name 116 | $AzureADDeviceID = ($AzureADJoinCertificate | Select-Object -ExpandProperty "Subject") -replace "CN=", "" 117 | } 118 | } 119 | 120 | #Get Computer Name 121 | $DeviceName = (Get-CIMInstance -ClassName Win32_OperatingSystem -NameSpace root\cimv2).CSName 122 | 123 | #Get OS Information 124 | $ComputerOSVersion = (Get-CIMInstance -ClassName Win32_OperatingSystem -NameSpace root\cimv2).Version 125 | $ComputerOSBuild = (Get-CIMInstance -ClassName Win32_OperatingSystem -NameSpace root\cimv2).BuildNumber 126 | 127 | #Get Default AU Service 128 | $DefaultAUService = (New-Object -ComObject "Microsoft.Update.ServiceManager").services | Where-Object { $_.IsDefaultAUService -eq 'True' } | Select-Object -ExpandProperty Name 129 | 130 | #endregion 131 | 132 | #region Functions 133 | 134 | 135 | Function Get-RegSetting { 136 | param ( 137 | [parameter(Mandatory = $True)] 138 | [ValidateNotNullOrEmpty()] 139 | [string]$RegKey, 140 | [string]$RegSetting 141 | ) 142 | Try { 143 | $RegSettingValue = Get-ItemPropertyValue -Path $RegKey -Name $RegSetting -ErrorAction Stop 144 | If (-not ($RegSettingValue -eq $Null)) { 145 | Return $RegSettingValue 146 | } 147 | else { 148 | If ($RegSetting -in ("WUServer", "WUStatusServer")) { 149 | Return "" 150 | } 151 | else { 152 | Return 0 153 | } 154 | } 155 | } 156 | Catch { 157 | #Not returning caught errors 158 | If ($RegSetting -in ("WUServer", "WUStatusServer")) { 159 | Return "" 160 | } 161 | else { 162 | Return 0 163 | } 164 | } 165 | } 166 | function Get-AzureADDeviceID { 167 | <# 168 | .SYNOPSIS 169 | Get the Azure AD device ID from the local device. 170 | 171 | .DESCRIPTION 172 | Get the Azure AD device ID from the local device. 173 | 174 | .NOTES 175 | Author: Nickolaj Andersen 176 | Contact: @NickolajA 177 | Created: 2021-05-26 178 | Updated: 2021-05-26 179 | 180 | Version history: 181 | 1.0.0 - (2021-05-26) Function created 182 | #> 183 | Process { 184 | # Define Cloud Domain Join information registry path 185 | $AzureADJoinInfoRegistryKeyPath = "HKLM:\SYSTEM\CurrentControlSet\Control\CloudDomainJoin\JoinInfo" 186 | 187 | # Retrieve the child key name that is the thumbprint of the machine certificate containing the device identifier guid 188 | $AzureADJoinInfoThumbprint = Get-ChildItem -Path $AzureADJoinInfoRegistryKeyPath | Select-Object -ExpandProperty "PSChildName" 189 | if ($AzureADJoinInfoThumbprint -ne $null) { 190 | # Retrieve the machine certificate based on thumbprint from registry key 191 | $AzureADJoinCertificate = Get-ChildItem -Path "Cert:\LocalMachine\My" -Recurse | Where-Object { $PSItem.Thumbprint -eq $AzureADJoinInfoThumbprint } 192 | if ($AzureADJoinCertificate -ne $null) { 193 | # Determine the device identifier from the subject name 194 | $AzureADDeviceID = ($AzureADJoinCertificate | Select-Object -ExpandProperty "Subject") -replace "CN=", "" 195 | # Handle return value 196 | return $AzureADDeviceID 197 | } 198 | } 199 | } 200 | } #endfunction 201 | function Get-AzureADJoinDate { 202 | <# 203 | .SYNOPSIS 204 | Get the Azure AD device ID from the local device. 205 | 206 | .DESCRIPTION 207 | Get the Azure AD device ID from the local device. 208 | 209 | .NOTES 210 | Author: Nickolaj Andersen 211 | Contact: @NickolajA 212 | Created: 2021-05-26 213 | Updated: 2021-05-26 214 | 215 | Version history: 216 | 1.0.0 - (2021-05-26) Function created 217 | #> 218 | Process { 219 | # Define Cloud Domain Join information registry path 220 | $AzureADJoinInfoRegistryKeyPath = "HKLM:\SYSTEM\CurrentControlSet\Control\CloudDomainJoin\JoinInfo" 221 | 222 | # Retrieve the child key name that is the thumbprint of the machine certificate containing the device identifier guid 223 | $AzureADJoinInfoThumbprint = Get-ChildItem -Path $AzureADJoinInfoRegistryKeyPath | Select-Object -ExpandProperty "PSChildName" 224 | if ($AzureADJoinInfoThumbprint -ne $null) { 225 | # Retrieve the machine certificate based on thumbprint from registry key 226 | $AzureADJoinCertificate = Get-ChildItem -Path "Cert:\LocalMachine\My" -Recurse | Where-Object { $PSItem.Thumbprint -eq $AzureADJoinInfoThumbprint } 227 | if ($AzureADJoinCertificate -ne $null) { 228 | # Determine the device identifier from the subject name 229 | $AzureADJoinDate = ($AzureADJoinCertificate | Select-Object -ExpandProperty "NotBefore") 230 | # Handle return value 231 | return $AzureADJoinDate 232 | } 233 | } 234 | } 235 | } #endfunction 236 | #Function to get AzureAD TenantID 237 | function Get-AzureADTenantID { 238 | # Cloud Join information registry path 239 | $AzureADTenantInfoRegistryKeyPath = "HKLM:\SYSTEM\CurrentControlSet\Control\CloudDomainJoin\TenantInfo" 240 | # Retrieve the child key name that is the tenant id for AzureAD 241 | $AzureADTenantID = Get-ChildItem -Path $AzureADTenantInfoRegistryKeyPath | Select-Object -ExpandProperty "PSChildName" 242 | return $AzureADTenantID 243 | } 244 | #endregion functions 245 | 246 | 247 | #region Workspace 248 | #Get Common data for validation in Azure Function: 249 | $AzureADDeviceID = Get-AzureADDeviceID 250 | $AzureADTenantID = Get-AzureADTenantID 251 | 252 | #Build WindowsUpdate Regsitry Key Inventory 253 | $WUSettingPayloadInventory = $Null 254 | $WUSettingPayloadInventory = New-Object -TypeName PSObject 255 | 256 | #Build Device Inventory 257 | $WUSettingPayloadInventory | Add-Member -MemberType NoteProperty -Name ScriptVersion -Value $ScriptVersion -Force 258 | $WUSettingPayloadInventory | Add-Member -MemberType NoteProperty -Name DeviceName -Value $DeviceName -Force 259 | $WUSettingPayloadInventory | Add-Member -MemberType NoteProperty -Name ManagedDeviceID -Value $ManagedDeviceID -Force 260 | $WUSettingPayloadInventory | Add-Member -MemberType NoteProperty -Name AzureADDeviceID -Value $AzureADDeviceID -Force 261 | $WUSettingPayloadInventory | Add-Member -MemberType NoteProperty -Name ComputerOSVersion -Value $ComputerOSVersion -Force 262 | $WUSettingPayloadInventory | Add-Member -MemberType NoteProperty -Name ComputerOSBuild -Value $ComputerOSBuild -Force 263 | $WUSettingPayloadInventory | Add-Member -MemberType NoteProperty -Name DefaultAUService -Value $DefaultAUService -Force 264 | 265 | #Get CoManagement State and Workload 266 | $CoMgmtRegKey = "HKLM:\Software\Microsoft\CCM" 267 | $CoMgmtSetting = "CoManagementFlags" 268 | $CoMgmtValue = Get-RegSetting -RegKey $CoMgmtRegKey -RegSetting $CoMgmtSetting 269 | If ($CoMgmtValue -in $CoMgmtArray) { 270 | $WUSettingPayloadInventory | Add-Member -MemberType NoteProperty -Name CoMgmtWorkload -Value $true -Force 271 | } 272 | else { 273 | $WUSettingPayloadInventory | Add-Member -MemberType NoteProperty -Name CoMgmtWorkload -Value $false -Force 274 | } 275 | $WUSettingPayloadInventory | Add-Member -MemberType NoteProperty -Name CoMgmtValue -Value $CoMgmtValue -Force 276 | 277 | #Get Registry Values for Software\Policies\Microsoft\Windows\WindowsUpdate 278 | $WURegKey = "HKLM:Software\Policies\Microsoft\Windows\WindowsUpdate" 279 | ForEach ($WUSetting in $WUSettingsArray) { 280 | $RegValue = Get-RegSetting -RegKey $WURegKey -RegSetting $WUSetting 281 | $WUSettingPayloadInventory | Add-Member -MemberType NoteProperty -Name $WUSetting -Value $RegValue -Force 282 | } 283 | 284 | #Get Registry Values for Software\Policies\Microsoft\Windows\WindowsUpdate 285 | $WUAURegKey = "HKLM:Software\Policies\Microsoft\Windows\WindowsUpdate\AU" 286 | ForEach ($WUAUSetting in $WUAUSettingsArray) { 287 | $RegValue = Get-RegSetting -RegKey $WUAURegKey -RegSetting $WUAUSetting 288 | $WUSettingPayloadInventory | Add-Member -MemberType NoteProperty -Name $WUAUSetting -Value $RegValue -Force 289 | } 290 | 291 | #Build Payload Array 292 | $WUSettingPayload = $Null 293 | $WUSettingPayload = @() 294 | $WUSettingPayload += $WUSettingPayloadInventory 295 | 296 | #Randomize over 50 minutes to spread load on Azure Function - disabled on date of enrollment (Disabled in sample - Enable only in larger environments) 297 | $JoinDate = Get-AzureADJoinDate 298 | $DelayDate = $JoinDate.AddDays(1) 299 | $CompareDate = ($DelayDate - $JoinDate) 300 | if ($CompareDate.Days -ge 1) { 301 | #Write-Output "Randomzing execution time" 302 | #$ExecuteInSeconds = (Get-Random -Maximum 3000 -Minimum 1) 303 | #Start-Sleep -Seconds $ExecuteInSeconds 304 | } 305 | #Start sending logs 306 | $date = Get-Date -Format "dd-MM HH:mm" 307 | $OutputMessage = "InventoryDate:$date " 308 | 309 | $headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]" 310 | $headers.Add("Content-Type", "application/json") 311 | 312 | # Add arrays of logs into payload array 313 | $LogPayLoad = New-Object -TypeName PSObject 314 | $LogPayLoad | Add-Member -NotePropertyMembers @{$CustomLogName = $WUSettingPayload } 315 | 316 | # Construct main payload to send to LogCollectorAPI // IMPORTANT // KEEP AND DO NOT CHANGE THIS 317 | $MainPayLoad = [PSCustomObject]@{ 318 | AzureADTenantID = $AzureADTenantID 319 | AzureADDeviceID = $AzureADDeviceID 320 | LogPayloads = $LogPayLoad 321 | } 322 | $MainPayLoadJson = $MainPayLoad | ConvertTo-Json -Depth 9 323 | 324 | #Write upload intent to console 325 | Write-Output "Sending Payload:" 326 | Write-Output $MainPayLoadJson 327 | 328 | # Sending data to API 329 | try { 330 | $ResponseInventory = Invoke-RestMethod $AzureFunctionURL -Method 'POST' -Headers $headers -Body $MainPayLoadJson 331 | $OutputMessage = $OutPutMessage + "Inventory:OK " + $ResponseInventory 332 | } 333 | catch { 334 | $ResponseInventory = "Error Code: $($_.Exception.Response.StatusCode.value__)" 335 | $ResponseMessage = $_.Exception.Message 336 | $OutputMessage = $OutPutMessage + "Inventory:Fail " + $ResponseInventory + $ResponseMessage 337 | } 338 | 339 | # Check status and report to Proactive Remediations 340 | if ($ResponseInventory -match "200") { 341 | Write-Output $OutputMessage 342 | Exit 0 343 | } 344 | else { 345 | Write-Output "Error: $($ResponseInventory), Message: $($ResponseMessage)" 346 | Exit 1 347 | } 348 | 349 | #endregion 350 | #> -------------------------------------------------------------------------------- /Workbooks/AppReliabilityDashboard.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "Notebook/1.0", 3 | "items": [ 4 | { 5 | "type": 1, 6 | "content": { 7 | "json": "\r\n" 8 | }, 9 | "name": "text - 5" 10 | }, 11 | { 12 | "type": 1, 13 | "content": { 14 | "json": "# Application Reliability Report\n---\n\nThe purpose of this dashboard is to provide similar functionality to the Windows Reliability Monitor, across all Windows devices in Intune / Configuration Manager.\n\n1. Application hang and error events\n2. Summary of top offending applications\n\n\n**Note:** Figures are updated on a 24 hour cycle." 15 | }, 16 | "customWidth": "60", 17 | "name": "text - 2" 18 | }, 19 | { 20 | "type": 3, 21 | "content": { 22 | "version": "KqlItem/1.0", 23 | "query": "AppReliability_CL \r\n| summarize arg_max(TimeGenerated, *)\r\n| project Type,TimeGenerated\r\n| sort by TimeGenerated asc", 24 | "size": 3, 25 | "timeContext": { 26 | "durationMs": 86400000 27 | }, 28 | "queryType": 0, 29 | "resourceType": "microsoft.operationalinsights/workspaces" 30 | }, 31 | "customWidth": "40", 32 | "name": "query - 4" 33 | }, 34 | { 35 | "type": 9, 36 | "content": { 37 | "version": "KqlParameterItem/1.0", 38 | "parameters": [ 39 | { 40 | "id": "e9b4aa93-ffd7-47a5-a1a7-485141b8f912", 41 | "version": "KqlParameterItem/1.0", 42 | "name": "TimeRange", 43 | "type": 4, 44 | "value": { 45 | "durationMs": 604800000 46 | }, 47 | "typeSettings": { 48 | "selectableValues": [ 49 | { 50 | "durationMs": 300000 51 | }, 52 | { 53 | "durationMs": 900000 54 | }, 55 | { 56 | "durationMs": 1800000 57 | }, 58 | { 59 | "durationMs": 3600000 60 | }, 61 | { 62 | "durationMs": 14400000 63 | }, 64 | { 65 | "durationMs": 43200000 66 | }, 67 | { 68 | "durationMs": 86400000 69 | }, 70 | { 71 | "durationMs": 172800000 72 | }, 73 | { 74 | "durationMs": 259200000 75 | }, 76 | { 77 | "durationMs": 604800000 78 | }, 79 | { 80 | "durationMs": 1209600000 81 | }, 82 | { 83 | "durationMs": 2419200000 84 | }, 85 | { 86 | "durationMs": 2592000000 87 | }, 88 | { 89 | "durationMs": 5184000000 90 | }, 91 | { 92 | "durationMs": 7776000000 93 | } 94 | ], 95 | "allowCustom": true 96 | }, 97 | "timeContext": { 98 | "durationMs": 86400000 99 | } 100 | }, 101 | { 102 | "id": "7031244f-c2fe-4104-ae5b-43992a6513e3", 103 | "version": "KqlParameterItem/1.0", 104 | "name": "LogWorkspace", 105 | "type": 1, 106 | "query": "resources\r\n| where name contains \"log-cloudwaymonitoring\" and type == \"microsoft.operationalinsights/workspaces\"\r\n| project id", 107 | "isHiddenWhenLocked": true, 108 | "queryType": 1, 109 | "resourceType": "microsoft.resourcegraph/resources" 110 | }, 111 | { 112 | "id": "c489aa2e-9d7b-4283-a935-ffeadc4b0a70", 113 | "version": "KqlParameterItem/1.0", 114 | "name": "DetailsWorkbook", 115 | "type": 1, 116 | "query": "resources\r\n| where type == \"microsoft.insights/workbooks\"\r\n| where properties.displayName has 'Application Reliability - App Details'\r\n| extend path = trim('[]', id)\r\n| project path", 117 | "isHiddenWhenLocked": true, 118 | "queryType": 1, 119 | "resourceType": "microsoft.resourcegraph/resources" 120 | } 121 | ], 122 | "style": "pills", 123 | "queryType": 1, 124 | "resourceType": "microsoft.resourcegraph/resources" 125 | }, 126 | "name": "Workbook Parameters" 127 | }, 128 | { 129 | "type": 3, 130 | "content": { 131 | "version": "KqlItem/1.0", 132 | "query": "AppReliability_CL \n| where isnotempty(EventGenerated_s)\n| summarize arg_max(EventGenerated_s, *) by ManagedDeviceID_g, Application_s, EventType_s \n| make-series Trend = count() default = 0 on todatetime(EventGenerated_s) from {TimeRange:start} to {TimeRange:end} step {TimeRange:grain} by Application_s", 133 | "size": 1, 134 | "timeContextFromParameter": "TimeRange", 135 | "queryType": 0, 136 | "resourceType": "microsoft.operationalinsights/workspaces", 137 | "visualization": "timechart" 138 | }, 139 | "name": "Reliability Events - By Application" 140 | }, 141 | { 142 | "type": 3, 143 | "content": { 144 | "version": "KqlItem/1.0", 145 | "query": "AppReliability_CL \n| where isnotempty(EventGenerated_s)\n| summarize arg_max(EventGenerated_s, *) by ManagedDeviceID_g, Application_s, EventType_s \n| make-series Trend = count() default = 0 on todatetime(EventGenerated_s) from {TimeRange:start} to {TimeRange:end} step {TimeRange:grain} by EventType_s", 146 | "size": 1, 147 | "queryType": 0, 148 | "resourceType": "microsoft.operationalinsights/workspaces", 149 | "visualization": "areachart", 150 | "chartSettings": { 151 | "showLegend": true, 152 | "seriesLabelSettings": [ 153 | { 154 | "seriesName": "Application Error", 155 | "color": "red" 156 | }, 157 | { 158 | "seriesName": "Application Hang", 159 | "color": "orange" 160 | } 161 | ] 162 | } 163 | }, 164 | "name": "Reliability Events Over Time" 165 | }, 166 | { 167 | "type": 3, 168 | "content": { 169 | "version": "KqlItem/1.0", 170 | "query": "AppReliability_CL \r\n| where isnotempty(EventGenerated_s) and EventType_s == \"Application Error\"\r\n| summarize arg_max(TimeGenerated, *) by ManagedDeviceID_g, Application_s \r\n| project EventGenerated_s, ComputerName_s, EventType_s, Application_s, ApplicationPublisher_s, ApplicationPath_s, ApplicationVersion_s\r\n| order by todatetime(EventGenerated_s) desc, EventType_s desc", 171 | "size": 0, 172 | "queryType": 0, 173 | "resourceType": "microsoft.operationalinsights/workspaces", 174 | "gridSettings": { 175 | "formatters": [ 176 | { 177 | "columnMatch": "EventType_s", 178 | "formatter": 18, 179 | "formatOptions": { 180 | "thresholdsOptions": "icons", 181 | "thresholdsGrid": [ 182 | { 183 | "operator": "contains", 184 | "thresholdValue": "Error", 185 | "representation": "3", 186 | "text": "{0}{1}" 187 | }, 188 | { 189 | "operator": "contains", 190 | "thresholdValue": "Hang", 191 | "representation": "2", 192 | "text": "{0}{1}" 193 | }, 194 | { 195 | "operator": "Default", 196 | "thresholdValue": null, 197 | "representation": "success", 198 | "text": "{0}{1}" 199 | } 200 | ] 201 | } 202 | }, 203 | { 204 | "columnMatch": "Application_s", 205 | "formatter": 1, 206 | "formatOptions": { 207 | "linkTarget": "WorkbookTemplate", 208 | "linkIsContextBlade": true, 209 | "workbookContext": { 210 | "componentIdSource": "parameter", 211 | "componentId": "DetailsWorkbook", 212 | "resourceIdsSource": "parameter", 213 | "resourceIds": "LogWorkspace", 214 | "templateIdSource": "parameter", 215 | "templateId": "DetailsWorkbook", 216 | "typeSource": "workbook", 217 | "gallerySource": "workbook", 218 | "locationSource": "default", 219 | "passSpecificParams": true, 220 | "templateParameters": [ 221 | { 222 | "name": "Application", 223 | "source": "column", 224 | "value": "Application_s" 225 | }, 226 | { 227 | "name": "TimeRange", 228 | "source": "parameter", 229 | "value": "TimeRange" 230 | }, 231 | { 232 | "name": "Publisher", 233 | "source": "column", 234 | "value": "ApplicationPublisher_s" 235 | } 236 | ] 237 | } 238 | } 239 | } 240 | ], 241 | "sortBy": [ 242 | { 243 | "itemKey": "ApplicationVersion_s", 244 | "sortOrder": 2 245 | } 246 | ] 247 | }, 248 | "sortBy": [ 249 | { 250 | "itemKey": "ApplicationVersion_s", 251 | "sortOrder": 2 252 | } 253 | ] 254 | }, 255 | "name": "Application Reliability Details" 256 | }, 257 | { 258 | "type": 1, 259 | "content": { 260 | "json": "-------------------" 261 | }, 262 | "name": "text - 9" 263 | }, 264 | { 265 | "type": 12, 266 | "content": { 267 | "version": "NotebookGroup/1.0", 268 | "groupType": "editable", 269 | "items": [ 270 | { 271 | "type": 1, 272 | "content": { 273 | "json": "## Application Error Events\r\n\r\nBelow are a list of application hang Error across your Windows 10/11 infrastructure. Application errors can occur due to compatibility issues, and you should pay attention to the faulting modules where present.", 274 | "style": "error" 275 | }, 276 | "name": "text - 10" 277 | }, 278 | { 279 | "type": 3, 280 | "content": { 281 | "version": "KqlItem/1.0", 282 | "query": "AppReliability_CL \r\n| where isnotempty(EventGenerated_s) and EventType_s == \"Application Error\"\r\n| summarize arg_max(EventGenerated_s, *) by ManagedDeviceID_g, Application_s, EventType_s \r\n| project EventGenerated_s, ComputerName_s, ManagedDeviceID_g, EventType_s, Application_s, ApplicationPublisher_s, ApplicationVersion_s\r\n| summarize dcount(ManagedDeviceID_g) by EventType_s, Application_s, ApplicationPublisher_s, ApplicationVersion_s\r\n| order by dcount_ManagedDeviceID_g desc", 283 | "size": 0, 284 | "queryType": 0, 285 | "resourceType": "microsoft.operationalinsights/workspaces", 286 | "gridSettings": { 287 | "formatters": [ 288 | { 289 | "columnMatch": "EventType_s", 290 | "formatter": 18, 291 | "formatOptions": { 292 | "thresholdsOptions": "icons", 293 | "thresholdsGrid": [ 294 | { 295 | "operator": "contains", 296 | "thresholdValue": "Error", 297 | "representation": "3", 298 | "text": "{0}{1}" 299 | }, 300 | { 301 | "operator": "contains", 302 | "thresholdValue": "Hang", 303 | "representation": "2", 304 | "text": "{0}{1}" 305 | }, 306 | { 307 | "operator": "Default", 308 | "thresholdValue": null, 309 | "representation": "success", 310 | "text": "{0}{1}" 311 | } 312 | ] 313 | } 314 | }, 315 | { 316 | "columnMatch": "Application_s", 317 | "formatter": 1, 318 | "formatOptions": { 319 | "linkTarget": "WorkbookTemplate", 320 | "linkIsContextBlade": true, 321 | "workbookContext": { 322 | "componentIdSource": "parameter", 323 | "componentId": "DetailsWorkbook", 324 | "resourceIdsSource": "parameter", 325 | "resourceIds": "LogWorkspace", 326 | "templateIdSource": "parameter", 327 | "templateId": "DetailsWorkbook", 328 | "typeSource": "workbook", 329 | "gallerySource": "workbook", 330 | "locationSource": "default", 331 | "passSpecificParams": true, 332 | "templateParameters": [ 333 | { 334 | "name": "Application", 335 | "source": "column", 336 | "value": "Application_s" 337 | }, 338 | { 339 | "name": "TimeRange", 340 | "source": "parameter", 341 | "value": "TimeRange" 342 | }, 343 | { 344 | "name": "Publisher", 345 | "source": "column", 346 | "value": "ApplicationPublisher_s" 347 | } 348 | ] 349 | } 350 | } 351 | }, 352 | { 353 | "columnMatch": "dcount_ManagedDeviceID_g", 354 | "formatter": 4, 355 | "formatOptions": { 356 | "palette": "red", 357 | "customColumnWidthSetting": "200px" 358 | } 359 | } 360 | ], 361 | "labelSettings": [ 362 | { 363 | "columnId": "EventType_s", 364 | "label": "Event" 365 | }, 366 | { 367 | "columnId": "Application_s", 368 | "label": "Application" 369 | }, 370 | { 371 | "columnId": "ApplicationVersion_s", 372 | "label": "Version" 373 | }, 374 | { 375 | "columnId": "dcount_ManagedDeviceID_g", 376 | "label": "Devices Impacted" 377 | } 378 | ] 379 | }, 380 | "sortBy": [] 381 | }, 382 | "name": "Application Reliability - Application Error Events" 383 | }, 384 | { 385 | "type": 1, 386 | "content": { 387 | "json": "## Application Hang Events\r\n\r\nBelow are a list of application hang events across your Windows 10/11 infrastructure. Where updated and patched versions of applications impacted are available, you should consider a phased test and rollout process, to ensure stability and improve the end-user experience.", 388 | "style": "warning" 389 | }, 390 | "name": "text - 9" 391 | }, 392 | { 393 | "type": 3, 394 | "content": { 395 | "version": "KqlItem/1.0", 396 | "query": "AppReliability_CL \r\n| where isnotempty(EventGenerated_s) and EventType_s == \"Application Hang\"\r\n| summarize arg_max(TimeGenerated, *) by ManagedDeviceID_g, Application_s, EventType_s \r\n| project EventGenerated_s, ComputerName_s, ManagedDeviceID_g, EventType_s, Application_s, ApplicationPublisher_s, ApplicationVersion_s\r\n| summarize dcount(ManagedDeviceID_g) by EventType_s, Application_s, ApplicationPublisher_s, ApplicationVersion_s\r\n| order by dcount_ManagedDeviceID_g desc", 397 | "size": 0, 398 | "timeContextFromParameter": "TimeRange", 399 | "queryType": 0, 400 | "resourceType": "microsoft.operationalinsights/workspaces", 401 | "gridSettings": { 402 | "formatters": [ 403 | { 404 | "columnMatch": "EventType_s", 405 | "formatter": 18, 406 | "formatOptions": { 407 | "thresholdsOptions": "icons", 408 | "thresholdsGrid": [ 409 | { 410 | "operator": "contains", 411 | "thresholdValue": "Error", 412 | "representation": "3", 413 | "text": "{0}{1}" 414 | }, 415 | { 416 | "operator": "contains", 417 | "thresholdValue": "Hang", 418 | "representation": "2", 419 | "text": "{0}{1}" 420 | }, 421 | { 422 | "operator": "Default", 423 | "thresholdValue": null, 424 | "representation": "success", 425 | "text": "{0}{1}" 426 | } 427 | ] 428 | } 429 | }, 430 | { 431 | "columnMatch": "Application_s", 432 | "formatter": 1, 433 | "formatOptions": { 434 | "linkTarget": "WorkbookTemplate", 435 | "linkIsContextBlade": true, 436 | "workbookContext": { 437 | "componentIdSource": "parameter", 438 | "componentId": "DetailsWorkbook", 439 | "resourceIdsSource": "parameter", 440 | "resourceIds": "LogWorkspace", 441 | "templateIdSource": "parameter", 442 | "templateId": "DetailsWorkbook", 443 | "typeSource": "workbook", 444 | "gallerySource": "workbook", 445 | "locationSource": "default", 446 | "passSpecificParams": true, 447 | "templateParameters": [ 448 | { 449 | "name": "Application", 450 | "source": "column", 451 | "value": "Application_s" 452 | }, 453 | { 454 | "name": "TimeRange", 455 | "source": "parameter", 456 | "value": "TimeRange" 457 | }, 458 | { 459 | "name": "Publisher", 460 | "source": "column", 461 | "value": "ApplicationPublisher_s" 462 | } 463 | ] 464 | } 465 | } 466 | }, 467 | { 468 | "columnMatch": "dcount_ManagedDeviceID_g", 469 | "formatter": 4, 470 | "formatOptions": { 471 | "palette": "orange", 472 | "customColumnWidthSetting": "200px" 473 | } 474 | } 475 | ], 476 | "labelSettings": [ 477 | { 478 | "columnId": "EventType_s", 479 | "label": "Event" 480 | }, 481 | { 482 | "columnId": "Application_s", 483 | "label": "Application" 484 | }, 485 | { 486 | "columnId": "ApplicationPublisher_s", 487 | "label": "Publisher" 488 | }, 489 | { 490 | "columnId": "ApplicationVersion_s", 491 | "label": "Version" 492 | }, 493 | { 494 | "columnId": "dcount_ManagedDeviceID_g", 495 | "label": "Devices Impacted" 496 | } 497 | ] 498 | }, 499 | "sortBy": [] 500 | }, 501 | "name": "Application Reliability - Application Hang Events" 502 | } 503 | ] 504 | }, 505 | "customWidth": "65", 506 | "name": "Application Reliability - Details" 507 | }, 508 | { 509 | "type": 12, 510 | "content": { 511 | "version": "NotebookGroup/1.0", 512 | "groupType": "editable", 513 | "items": [ 514 | { 515 | "type": 1, 516 | "content": { 517 | "json": "## Application Issue Summary", 518 | "style": "info" 519 | }, 520 | "name": "Application Issue Summary" 521 | }, 522 | { 523 | "type": 3, 524 | "content": { 525 | "version": "KqlItem/1.0", 526 | "query": "AppReliability_CL \r\n| where isnotempty(EventGenerated_s) and isnotempty(ApplicationPublisher_s)\r\n| summarize arg_max(EventGenerated_s, *) by ManagedDeviceID_g, Application_s, EventType_s \r\n| project EventGenerated_s, ComputerName_s, ManagedDeviceID_g, EventType_s, Application_s, ApplicationPublisher_s, ApplicationVersion_s\r\n| summarize dcount(ManagedDeviceID_g) by ApplicationPublisher_s\r\n| order by dcount_ManagedDeviceID_g desc", 527 | "size": 3, 528 | "title": "Application Reliability Issues - By Manufacturer ", 529 | "queryType": 0, 530 | "resourceType": "microsoft.operationalinsights/workspaces", 531 | "visualization": "piechart", 532 | "gridSettings": { 533 | "formatters": [ 534 | { 535 | "columnMatch": "EventType_s", 536 | "formatter": 18, 537 | "formatOptions": { 538 | "thresholdsOptions": "icons", 539 | "thresholdsGrid": [ 540 | { 541 | "operator": "contains", 542 | "thresholdValue": "Error", 543 | "representation": "2", 544 | "text": "{0}{1}" 545 | }, 546 | { 547 | "operator": "contains", 548 | "thresholdValue": "Hang", 549 | "representation": "4", 550 | "text": "{0}{1}" 551 | }, 552 | { 553 | "operator": "Default", 554 | "thresholdValue": null, 555 | "representation": "success", 556 | "text": "{0}{1}" 557 | } 558 | ] 559 | } 560 | }, 561 | { 562 | "columnMatch": "dcount_ManagedDeviceID_g", 563 | "formatter": 4, 564 | "formatOptions": { 565 | "palette": "orange", 566 | "customColumnWidthSetting": "200px" 567 | } 568 | } 569 | ], 570 | "labelSettings": [ 571 | { 572 | "columnId": "EventType_s", 573 | "label": "Event" 574 | }, 575 | { 576 | "columnId": "ApplicationPublisher_s", 577 | "label": "Publisher" 578 | }, 579 | { 580 | "columnId": "dcount_ManagedDeviceID_g", 581 | "label": "Devices Impacted" 582 | } 583 | ] 584 | }, 585 | "sortBy": [], 586 | "tileSettings": { 587 | "showBorder": false, 588 | "titleContent": { 589 | "columnMatch": "ApplicationPublisher_s", 590 | "formatter": 1 591 | }, 592 | "leftContent": { 593 | "columnMatch": "dcount_ManagedDeviceID_g", 594 | "formatter": 12, 595 | "formatOptions": { 596 | "palette": "auto" 597 | }, 598 | "numberFormat": { 599 | "unit": 17, 600 | "options": { 601 | "maximumSignificantDigits": 3, 602 | "maximumFractionDigits": 2 603 | } 604 | } 605 | } 606 | } 607 | }, 608 | "name": "Application Reliability Issues - By Manufacturer " 609 | }, 610 | { 611 | "type": 3, 612 | "content": { 613 | "version": "KqlItem/1.0", 614 | "query": "AppReliability_CL \r\n| where isnotempty(EventGenerated_s) and isnotempty(ApplicationPublisher_s)\r\n| summarize arg_max(EventGenerated_s, *) by ManagedDeviceID_g, Application_s, EventType_s \r\n| project EventGenerated_s, ComputerName_s, ManagedDeviceID_g, EventType_s, Application_s, ApplicationPublisher_s, ApplicationVersion_s\r\n| summarize dcount(ManagedDeviceID_g) by Application_s\r\n| order by dcount_ManagedDeviceID_g desc\r\n| take 20", 615 | "size": 3, 616 | "title": "Application Reliability Issues - By Exe", 617 | "queryType": 0, 618 | "resourceType": "microsoft.operationalinsights/workspaces", 619 | "visualization": "table", 620 | "gridSettings": { 621 | "formatters": [ 622 | { 623 | "columnMatch": "dcount_ManagedDeviceID_g", 624 | "formatter": 4, 625 | "formatOptions": { 626 | "palette": "greenRed", 627 | "customColumnWidthSetting": "200px" 628 | } 629 | }, 630 | { 631 | "columnMatch": "EventType_s", 632 | "formatter": 18, 633 | "formatOptions": { 634 | "thresholdsOptions": "icons", 635 | "thresholdsGrid": [ 636 | { 637 | "operator": "contains", 638 | "thresholdValue": "Error", 639 | "representation": "2", 640 | "text": "{0}{1}" 641 | }, 642 | { 643 | "operator": "contains", 644 | "thresholdValue": "Hang", 645 | "representation": "4", 646 | "text": "{0}{1}" 647 | }, 648 | { 649 | "operator": "Default", 650 | "thresholdValue": null, 651 | "representation": "success", 652 | "text": "{0}{1}" 653 | } 654 | ] 655 | } 656 | } 657 | ], 658 | "labelSettings": [ 659 | { 660 | "columnId": "dcount_ManagedDeviceID_g", 661 | "label": "Devices Impacted" 662 | } 663 | ] 664 | }, 665 | "sortBy": [], 666 | "tileSettings": { 667 | "showBorder": false, 668 | "titleContent": { 669 | "columnMatch": "ApplicationPublisher_s", 670 | "formatter": 1 671 | }, 672 | "leftContent": { 673 | "columnMatch": "dcount_ManagedDeviceID_g", 674 | "formatter": 12, 675 | "formatOptions": { 676 | "palette": "auto" 677 | }, 678 | "numberFormat": { 679 | "unit": 17, 680 | "options": { 681 | "maximumSignificantDigits": 3, 682 | "maximumFractionDigits": 2 683 | } 684 | } 685 | } 686 | }, 687 | "chartSettings": { 688 | "createOtherGroup": 6 689 | } 690 | }, 691 | "name": "Application Reliability Issues - By Exe - Top 15" 692 | } 693 | ] 694 | }, 695 | "customWidth": "35", 696 | "name": "Application Reliability - Graphs" 697 | } 698 | ], 699 | "$schema": "https://github.com/Microsoft/Application-Insights-Workbooks/blob/master/schema/workbook.json" 700 | } 701 | -------------------------------------------------------------------------------- /Workbooks/AppReliabilityDetails.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "Notebook/1.0", 3 | "items": [ 4 | { 5 | "type": 9, 6 | "content": { 7 | "version": "KqlParameterItem/1.0", 8 | "parameters": [ 9 | { 10 | "id": "94daf261-d2b7-405d-88ca-fed40dee1e64", 11 | "version": "KqlParameterItem/1.0", 12 | "name": "Application", 13 | "type": 1, 14 | "isHiddenWhenLocked": true, 15 | "timeContext": { 16 | "durationMs": 86400000 17 | }, 18 | "value": "" 19 | }, 20 | { 21 | "id": "eed46422-3d7b-43cd-acae-b17f547d6e89", 22 | "version": "KqlParameterItem/1.0", 23 | "name": "Publisher", 24 | "type": 1, 25 | "isHiddenWhenLocked": true, 26 | "timeContext": { 27 | "durationMs": 86400000 28 | }, 29 | "value": "" 30 | }, 31 | { 32 | "id": "b8e27e30-f99c-4994-b78e-4f19b86b8efb", 33 | "version": "KqlParameterItem/1.0", 34 | "name": "TimeRange", 35 | "type": 4, 36 | "typeSettings": { 37 | "selectableValues": [ 38 | { 39 | "durationMs": 3600000 40 | }, 41 | { 42 | "durationMs": 14400000 43 | }, 44 | { 45 | "durationMs": 43200000 46 | }, 47 | { 48 | "durationMs": 86400000 49 | }, 50 | { 51 | "durationMs": 172800000 52 | }, 53 | { 54 | "durationMs": 259200000 55 | }, 56 | { 57 | "durationMs": 604800000 58 | }, 59 | { 60 | "durationMs": 1209600000 61 | }, 62 | { 63 | "durationMs": 2419200000 64 | }, 65 | { 66 | "durationMs": 2592000000 67 | }, 68 | { 69 | "durationMs": 5184000000 70 | }, 71 | { 72 | "durationMs": 7776000000 73 | } 74 | ] 75 | }, 76 | "timeContext": { 77 | "durationMs": 86400000 78 | }, 79 | "value": { 80 | "durationMs": 1209600000 81 | } 82 | }, 83 | { 84 | "id": "cddf82a4-c62a-45dc-b7a2-afd1443565fe", 85 | "version": "KqlParameterItem/1.0", 86 | "name": "FirstSeen", 87 | "label": "First Seen", 88 | "type": 1, 89 | "query": "AppReliability_CL \r\n| summarize arg_min(EventGenerated_s, *) by Application_s\r\n| order by todatetime(EventGenerated_s) asc\r\n| take 1\r\n| project TimeGenerated", 90 | "isHiddenWhenLocked": true, 91 | "queryType": 0, 92 | "resourceType": "microsoft.operationalinsights/workspaces", 93 | "value": "" 94 | }, 95 | { 96 | "id": "37dcfeb1-f5c3-48f5-82b0-a102ab0cebd0", 97 | "version": "KqlParameterItem/1.0", 98 | "name": "LastSeen", 99 | "label": "Last Seen", 100 | "type": 1, 101 | "query": "AppReliability_CL \r\n| summarize arg_max(EventGenerated_s, *) by Application_s\r\n| order by todatetime(EventGenerated_s) desc\r\n| take 1\r\n| project TimeGenerated", 102 | "isHiddenWhenLocked": true, 103 | "timeContext": { 104 | "durationMs": 1209600000 105 | }, 106 | "timeContextFromParameter": "TimeRange", 107 | "queryType": 0, 108 | "resourceType": "microsoft.operationalinsights/workspaces", 109 | "value": "" 110 | }, 111 | { 112 | "id": "8ac503ed-905d-40e1-9d04-a4ee770bfce9", 113 | "version": "KqlParameterItem/1.0", 114 | "name": "RuleType", 115 | "type": 1, 116 | "value": "", 117 | "isHiddenWhenLocked": true, 118 | "timeContext": { 119 | "durationMs": 5184000000 120 | }, 121 | "timeContextFromParameter": "TimeRange" 122 | }, 123 | { 124 | "id": "d5ec973e-fc2b-416c-8ed5-bf9bef76f0f8", 125 | "version": "KqlParameterItem/1.0", 126 | "name": "AdditionalApps", 127 | "type": 1, 128 | "description": "This parameter is used to display additional app reliability events based on manufacturer", 129 | "query": "AppReliability_CL \r\n| where ApplicationPublisher_s contains \"{Publisher}\" and isnotempty(ApplicationPublisher_s) and Application_s != \"{Application}\"\r\n| summarize count()\r\n| project count_", 130 | "isHiddenWhenLocked": true, 131 | "timeContext": { 132 | "durationMs": 0 133 | }, 134 | "timeContextFromParameter": "TimeRange", 135 | "queryType": 0, 136 | "resourceType": "microsoft.operationalinsights/workspaces", 137 | "value": "" 138 | } 139 | ], 140 | "style": "pills", 141 | "queryType": 0, 142 | "resourceType": "microsoft.operationalinsights/workspaces" 143 | }, 144 | "name": "parameters - 1" 145 | }, 146 | { 147 | "type": 1, 148 | "content": { 149 | "json": "## Application Reliability Details - {Application}\n\n---\n\n\n\n \n \n \n\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\n
{RuleType} Information
Application{Application}
Publisher{Publisher}
First Event{FirstSeen}
Last Event{LastSeen}
\n\n\nBelow are detailed descriptions on the {Application} application reliability events detected across your environment.\n\n---\n" 150 | }, 151 | "name": "text - 2" 152 | }, 153 | { 154 | "type": 3, 155 | "content": { 156 | "version": "KqlItem/1.0", 157 | "query": "AppReliability_CL \r\n| where Application_s == \"{Application}\"\r\n| summarize arg_max(todatetime(EventGenerated_s), *) by ManagedDeviceID_g\r\n| make-series Trend = count() default = 0 on TimeGenerated from {TimeRange:start} to {TimeRange:end} step {TimeRange:grain} by EventType_s", 158 | "size": 1, 159 | "title": "{Application} Reliability Events - {TimeRange}", 160 | "timeContextFromParameter": "TimeRange", 161 | "queryType": 0, 162 | "resourceType": "microsoft.operationalinsights/workspaces", 163 | "visualization": "areachart", 164 | "chartSettings": { 165 | "seriesLabelSettings": [ 166 | { 167 | "seriesName": "Application Error", 168 | "color": "red" 169 | }, 170 | { 171 | "seriesName": "Application Hang", 172 | "color": "orange" 173 | } 174 | ] 175 | } 176 | }, 177 | "name": "{Application} Reliability Events - {TimeRange}" 178 | }, 179 | { 180 | "type": 3, 181 | "content": { 182 | "version": "KqlItem/1.0", 183 | "query": "AppReliability_CL \r\n| where Application_s == \"{Application}\"\r\n| summarize arg_max(TimeGenerated, *) by ManagedDeviceID_g, ApplicationVersion_s\r\n| summarize dcount(ManagedDeviceID_g) by ApplicationVersion_s", 184 | "size": 3, 185 | "title": "{Application} - Version Count", 186 | "timeContextFromParameter": "TimeRange", 187 | "queryType": 0, 188 | "resourceType": "microsoft.operationalinsights/workspaces", 189 | "visualization": "piechart" 190 | }, 191 | "conditionalVisibility": { 192 | "parameterName": "RuleType", 193 | "comparison": "isNotEqualTo", 194 | "value": "Script" 195 | }, 196 | "name": "{RuleType_s} - Version Count" 197 | }, 198 | { 199 | "type": 1, 200 | "content": { 201 | "json": "## Faulting Modules\r\n\r\nBelow are a list of modules which were assoicated with the application crash / hang events", 202 | "style": "info" 203 | }, 204 | "name": "text - 9" 205 | }, 206 | { 207 | "type": 3, 208 | "content": { 209 | "version": "KqlItem/1.0", 210 | "query": "AppReliability_CL \r\n| where Application_s contains \"{Application}\" and isnotempty(Application_s) and isnotempty(EventGenerated_s) and isnotempty(FaultingModule_s)\r\n| summarize arg_max(todatetime(EventGenerated_s), *) by Application_s, FaultingModule_s, FaultingModulePath_s\r\n| summarize dcount(FaultingModule_s) by Application_s, FaultingModule_s, FaultingModulePath_s\r\n| project-away Application_s\r\n| order by dcount_FaultingModule_s desc", 211 | "size": 3, 212 | "showAnalytics": true, 213 | "title": "{Application} - Faulting Module Locations", 214 | "timeContextFromParameter": "TimeRange", 215 | "queryType": 0, 216 | "resourceType": "microsoft.operationalinsights/workspaces", 217 | "visualization": "table", 218 | "gridSettings": { 219 | "formatters": [ 220 | { 221 | "columnMatch": "dcount_FaultingModule_s", 222 | "formatter": 4, 223 | "formatOptions": { 224 | "palette": "greenRed" 225 | } 226 | }, 227 | { 228 | "columnMatch": "EventType_s", 229 | "formatter": 18, 230 | "formatOptions": { 231 | "thresholdsOptions": "icons", 232 | "thresholdsGrid": [ 233 | { 234 | "operator": "==", 235 | "thresholdValue": "Audited", 236 | "representation": "1", 237 | "text": "{0}{1}" 238 | }, 239 | { 240 | "operator": "==", 241 | "thresholdValue": "Denied", 242 | "representation": "2", 243 | "text": "{0}{1}" 244 | }, 245 | { 246 | "operator": "Default", 247 | "thresholdValue": null, 248 | "representation": "success", 249 | "text": "{0}{1}" 250 | } 251 | ] 252 | } 253 | } 254 | ], 255 | "rowLimit": 50, 256 | "labelSettings": [ 257 | { 258 | "columnId": "FaultingModule_s", 259 | "label": "Faulting Module" 260 | }, 261 | { 262 | "columnId": "FaultingModulePath_s", 263 | "label": "Module Path" 264 | }, 265 | { 266 | "columnId": "dcount_FaultingModule_s", 267 | "label": "Count" 268 | } 269 | ] 270 | }, 271 | "chartSettings": { 272 | "seriesLabelSettings": [ 273 | { 274 | "seriesName": "Audited", 275 | "color": "green" 276 | }, 277 | { 278 | "seriesName": "Denied", 279 | "color": "red" 280 | } 281 | ] 282 | } 283 | }, 284 | "name": "Application - Faulting Module Locations" 285 | }, 286 | { 287 | "type": 1, 288 | "content": { 289 | "json": "## Impacted Computers\r\n\r\nBelow is a list of computers with reliability events for the selected application ({$Application})", 290 | "style": "info" 291 | }, 292 | "name": "Computers" 293 | }, 294 | { 295 | "type": 3, 296 | "content": { 297 | "version": "KqlItem/1.0", 298 | "query": "AppReliability_CL \r\n| where Application_s contains \"{Application}\" and isnotempty(Application_s) and isnotempty(EventGenerated_s) \r\n| summarize arg_max(todatetime(EventGenerated_s), *) by ManagedDeviceID_g, EventType_s\r\n| project EventType_s, ComputerName_s, EventGenerated_s\r\n| order by todatetime(EventGenerated_s) desc\r\n\r\n\r\n", 299 | "size": 1, 300 | "showAnalytics": true, 301 | "title": "{Application} - Computer Incidents - Top 1000 ", 302 | "timeContextFromParameter": "TimeRange", 303 | "queryType": 0, 304 | "resourceType": "microsoft.operationalinsights/workspaces", 305 | "gridSettings": { 306 | "formatters": [ 307 | { 308 | "columnMatch": "EventType_s", 309 | "formatter": 18, 310 | "formatOptions": { 311 | "thresholdsOptions": "icons", 312 | "thresholdsGrid": [ 313 | { 314 | "operator": "contains", 315 | "thresholdValue": "Error", 316 | "representation": "3", 317 | "text": "{0}{1}" 318 | }, 319 | { 320 | "operator": "contains", 321 | "thresholdValue": "Hang", 322 | "representation": "2", 323 | "text": "{0}{1}" 324 | }, 325 | { 326 | "operator": "Default", 327 | "thresholdValue": null, 328 | "representation": "success", 329 | "text": "{0}{1}" 330 | } 331 | ] 332 | } 333 | } 334 | ], 335 | "rowLimit": 1000, 336 | "hierarchySettings": { 337 | "treeType": 1, 338 | "groupBy": [ 339 | "EventType_s" 340 | ], 341 | "expandTopLevel": false 342 | }, 343 | "sortBy": [ 344 | { 345 | "itemKey": "EventGenerated_s", 346 | "sortOrder": 1 347 | } 348 | ], 349 | "labelSettings": [ 350 | { 351 | "columnId": "EventType_s", 352 | "label": "Event Type" 353 | }, 354 | { 355 | "columnId": "ComputerName_s", 356 | "label": "Computer Name" 357 | }, 358 | { 359 | "columnId": "EventGenerated_s", 360 | "label": "Event Generated" 361 | } 362 | ] 363 | }, 364 | "sortBy": [ 365 | { 366 | "itemKey": "EventGenerated_s", 367 | "sortOrder": 1 368 | } 369 | ] 370 | }, 371 | "name": "{Application} - Computer Incidents - Top 1000 " 372 | }, 373 | { 374 | "type": 1, 375 | "content": { 376 | "json": "----" 377 | }, 378 | "name": "Line Break" 379 | }, 380 | { 381 | "type": 12, 382 | "content": { 383 | "version": "NotebookGroup/1.0", 384 | "groupType": "editable", 385 | "items": [ 386 | { 387 | "type": 1, 388 | "content": { 389 | "json": "## {Publisher} Additional Events\r\n\r\nBelow are a list of additional applications from {Publisher} which have reliabiltiy detection events regsitered against them:", 390 | "style": "warning" 391 | }, 392 | "name": "text - 7" 393 | }, 394 | { 395 | "type": 3, 396 | "content": { 397 | "version": "KqlItem/1.0", 398 | "query": "AppReliability_CL \r\n| where ApplicationPublisher_s contains \"{Publisher}\" and isnotempty(ApplicationPublisher_s) and Application_s != \"{Application}\"\r\n| summarize dcount(Computer) by Application_s, EventType_s, ApplicationPublisher_s\r\n| order by dcount_Computer desc", 399 | "size": 3, 400 | "title": "{Publisher} - Additional Application Incidents", 401 | "noDataMessage": "No additional AppLocker events detected from this publisher", 402 | "timeContextFromParameter": "TimeRange", 403 | "queryType": 0, 404 | "resourceType": "microsoft.operationalinsights/workspaces", 405 | "visualization": "table", 406 | "gridSettings": { 407 | "formatters": [ 408 | { 409 | "columnMatch": "EventType_s", 410 | "formatter": 18, 411 | "formatOptions": { 412 | "thresholdsOptions": "icons", 413 | "thresholdsGrid": [ 414 | { 415 | "operator": "contains", 416 | "thresholdValue": "Hang", 417 | "representation": "2", 418 | "text": "{0}{1}" 419 | }, 420 | { 421 | "operator": "contains", 422 | "thresholdValue": "Error", 423 | "representation": "3", 424 | "text": "{0}{1}" 425 | }, 426 | { 427 | "operator": "Default", 428 | "thresholdValue": null, 429 | "representation": "success", 430 | "text": "{0}{1}" 431 | } 432 | ] 433 | } 434 | }, 435 | { 436 | "columnMatch": "dcount_Computer", 437 | "formatter": 4, 438 | "formatOptions": { 439 | "palette": "greenRed" 440 | } 441 | }, 442 | { 443 | "columnMatch": "FullPublisherName_BinaryName_s", 444 | "formatter": 1, 445 | "formatOptions": { 446 | "linkColumn": "FullPublisherName_BinaryName_s", 447 | "linkTarget": "WorkbookTemplate", 448 | "linkIsContextBlade": true, 449 | "workbookContext": { 450 | "componentIdSource": "parameter", 451 | "componentId": "DetailsWorkbook", 452 | "resourceIdsSource": "parameter", 453 | "resourceIds": "LogWorkspace", 454 | "templateIdSource": "parameter", 455 | "templateId": "DetailsWorkbook", 456 | "typeSource": "workbook", 457 | "gallerySource": "workbook", 458 | "locationSource": "default", 459 | "passSpecificParams": true, 460 | "templateParameters": [ 461 | { 462 | "name": "Application", 463 | "source": "column", 464 | "value": "FullPublisherName_BinaryName_s" 465 | }, 466 | { 467 | "name": "Publisher", 468 | "source": "parameter", 469 | "value": "Publisher" 470 | }, 471 | { 472 | "name": "TimeRange", 473 | "source": "parameter", 474 | "value": "TimeRange" 475 | } 476 | ] 477 | } 478 | } 479 | } 480 | ], 481 | "labelSettings": [ 482 | { 483 | "columnId": "EventType_s", 484 | "label": "Action" 485 | }, 486 | { 487 | "columnId": "dcount_Computer", 488 | "label": "Devices" 489 | } 490 | ] 491 | }, 492 | "sortBy": [], 493 | "tileSettings": { 494 | "showBorder": false, 495 | "titleContent": { 496 | "columnMatch": "FullPublisherName_ProductName_s", 497 | "formatter": 1 498 | }, 499 | "leftContent": { 500 | "columnMatch": "count_", 501 | "formatter": 12, 502 | "formatOptions": { 503 | "palette": "auto" 504 | }, 505 | "numberFormat": { 506 | "unit": 17, 507 | "options": { 508 | "maximumSignificantDigits": 3, 509 | "maximumFractionDigits": 2 510 | } 511 | } 512 | } 513 | }, 514 | "chartSettings": { 515 | "xAxis": "FullPublisherName_BinaryName_s", 516 | "group": "EventType_s", 517 | "createOtherGroup": null, 518 | "showMetrics": false 519 | } 520 | }, 521 | "conditionalVisibilities": [ 522 | { 523 | "parameterName": "Publisher", 524 | "comparison": "isNotEqualTo", 525 | "value": "Unsigned" 526 | }, 527 | { 528 | "parameterName": "RuleType", 529 | "comparison": "isNotEqualTo", 530 | "value": "Script" 531 | } 532 | ], 533 | "name": "Publisher - Additional Application Incidents" 534 | } 535 | ] 536 | }, 537 | "conditionalVisibility": { 538 | "parameterName": "AdditionalApps", 539 | "comparison": "isNotEqualTo", 540 | "value": "" 541 | }, 542 | "name": "Additional Apps" 543 | } 544 | ], 545 | "$schema": "https://github.com/Microsoft/Application-Insights-Workbooks/blob/master/schema/workbook.json" 546 | } -------------------------------------------------------------------------------- /Workbooks/BIOSUpdateComplianceOEM.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "Notebook/1.0", 3 | "items": [ 4 | { 5 | "type": 1, 6 | "content": { 7 | "json": "## BIOS Update Compliance Report (OEM Direct)\r\n---\r\n" 8 | }, 9 | "name": "text - 2" 10 | }, 11 | { 12 | "type": 9, 13 | "content": { 14 | "version": "KqlParameterItem/1.0", 15 | "parameters": [ 16 | { 17 | "id": "2139aebd-839c-45a0-8b2f-e89a21484312", 18 | "version": "KqlParameterItem/1.0", 19 | "name": "TimeRange", 20 | "type": 4, 21 | "value": { 22 | "durationMs": 2592000000 23 | }, 24 | "typeSettings": { 25 | "selectableValues": [ 26 | { 27 | "durationMs": 86400000 28 | }, 29 | { 30 | "durationMs": 172800000 31 | }, 32 | { 33 | "durationMs": 259200000 34 | }, 35 | { 36 | "durationMs": 604800000 37 | }, 38 | { 39 | "durationMs": 1209600000 40 | }, 41 | { 42 | "durationMs": 2419200000 43 | }, 44 | { 45 | "durationMs": 2592000000 46 | }, 47 | { 48 | "durationMs": 5184000000 49 | }, 50 | { 51 | "durationMs": 7776000000 52 | } 53 | ], 54 | "allowCustom": true 55 | }, 56 | "timeContext": { 57 | "durationMs": 86400000 58 | } 59 | } 60 | ], 61 | "style": "pills", 62 | "queryType": 0, 63 | "resourceType": "microsoft.operationalinsights/workspaces" 64 | }, 65 | "name": "parameters - 10" 66 | }, 67 | { 68 | "type": 3, 69 | "content": { 70 | "version": "KqlItem/1.0", 71 | "query": "let BIOSDATA = OEMBIOSInformation_CL \n| summarize arg_max(TimeGenerated, *) by SKU_s;\nDeviceInventory_CL\n| join kind=leftouter BIOSDATA on $right.SKU_s == $left.SystemSKU_s\n| where OEM_s == \"HP\" or OEM_s == \"Dell\" or OEM_s == \"Lenovo\" or OEM_s == \"Dell Inc.\"\n| extend ComputerOEMUpdateStatus = iff((parse_version(BiosVersion_s) < parse_version(OEMVersion_s)), \"Update available from OEM\", \"OK\")\n| summarize arg_max(TimeGenerated, *) by ManagedDeviceID_g\n| project TimeGenerated, ComputerName_s, OEM_s, Model_s, todatetime(OEMDate_s), todatetime(BiosDate_s), OEMVersion_s, BiosVersion_s, ComputerOEMUpdateStatus, ManagedDeviceName_s\n| summarize dcount(Model_s) by OEM_s\n", 72 | "size": 3, 73 | "title": "Intune Supported Models for BIOS Reporting", 74 | "timeContext": { 75 | "durationMs": 2592000000 76 | }, 77 | "exportFieldName": "Manufacturer", 78 | "exportParameterName": "Manufacturer", 79 | "exportDefaultValue": "All Manufacturers", 80 | "queryType": 0, 81 | "resourceType": "microsoft.operationalinsights/workspaces", 82 | "visualization": "tiles", 83 | "gridSettings": { 84 | "sortBy": [ 85 | { 86 | "itemKey": "Manufacturer", 87 | "sortOrder": 1 88 | } 89 | ] 90 | }, 91 | "sortBy": [ 92 | { 93 | "itemKey": "Manufacturer", 94 | "sortOrder": 1 95 | } 96 | ], 97 | "tileSettings": { 98 | "titleContent": { 99 | "columnMatch": "OEM", 100 | "formatter": 1 101 | }, 102 | "leftContent": { 103 | "columnMatch": "dcount_Model_s", 104 | "formatter": 12, 105 | "formatOptions": { 106 | "palette": "auto" 107 | }, 108 | "numberFormat": { 109 | "unit": 17, 110 | "options": { 111 | "style": "decimal", 112 | "maximumFractionDigits": 2, 113 | "maximumSignificantDigits": 3 114 | } 115 | } 116 | }, 117 | "secondaryContent": { 118 | "columnMatch": "OEM_s", 119 | "numberFormat": { 120 | "unit": 0, 121 | "options": { 122 | "style": "decimal" 123 | }, 124 | "emptyValCustomText": "Unknown" 125 | } 126 | }, 127 | "showBorder": false 128 | } 129 | }, 130 | "name": "query - 2" 131 | }, 132 | { 133 | "type": 3, 134 | "content": { 135 | "version": "KqlItem/1.0", 136 | "query": "let BIOSDATA = OEMBIOSInformation_CL \r\n| summarize arg_max(TimeGenerated, *) by SKU_s;\r\nDeviceInventory_CL\r\n| join kind=leftouter BIOSDATA on $right.SKU_s == $left.SystemSKU_s\r\n| where OEM_s == \"HP\" or OEM_s == \"Dell\" or OEM_s == \"Lenovo\" or OEM_s == \"Dell Inc.\"\t\r\n| extend ComputerOEMUpdateStatus = iff((parse_version(BiosVersion_s) < parse_version(OEMVersion_s)), \"Update available from OEM\", \"OK\")\r\n| summarize arg_max(TimeGenerated, *) by ManagedDeviceID_g\r\n| distinct OEM_s, Model_s, SystemSKU_s\r\n", 137 | "size": 3, 138 | "title": "Model list from BIOS Table", 139 | "timeContext": { 140 | "durationMs": 2592000000 141 | }, 142 | "showExportToExcel": true, 143 | "exportToExcelOptions": "all", 144 | "queryType": 0, 145 | "resourceType": "microsoft.operationalinsights/workspaces", 146 | "visualization": "table", 147 | "gridSettings": { 148 | "sortBy": [ 149 | { 150 | "itemKey": "OEM_s", 151 | "sortOrder": 1 152 | } 153 | ], 154 | "labelSettings": [ 155 | { 156 | "columnId": "OEM_s", 157 | "label": "Manufacturer" 158 | }, 159 | { 160 | "columnId": "Model_s", 161 | "label": "Model" 162 | }, 163 | { 164 | "columnId": "SystemSKU_s", 165 | "label": "SKU" 166 | } 167 | ] 168 | }, 169 | "sortBy": [ 170 | { 171 | "itemKey": "OEM_s", 172 | "sortOrder": 1 173 | } 174 | ], 175 | "tileSettings": { 176 | "showBorder": false 177 | }, 178 | "graphSettings": { 179 | "type": 0 180 | }, 181 | "mapSettings": { 182 | "locInfo": "LatLong" 183 | } 184 | }, 185 | "name": "query - 2" 186 | }, 187 | { 188 | "type": 1, 189 | "content": { 190 | "json": "## BIOS Compliance" 191 | }, 192 | "name": "text - 4" 193 | }, 194 | { 195 | "type": 1, 196 | "content": { 197 | "json": "Please note that values below are updated according to the frequency of your assigned proactive remediation script.", 198 | "style": "info" 199 | }, 200 | "name": "text - 9" 201 | }, 202 | { 203 | "type": 3, 204 | "content": { 205 | "version": "KqlItem/1.0", 206 | "query": "let BIOSDATA = OEMBIOSInformation_CL \r\n| summarize arg_max(TimeGenerated, *) by SKU_s;\r\nDeviceInventory_CL\r\n| join kind=leftouter BIOSDATA on $right.SKU_s == $left.SystemSKU_s\r\n| where OEM_s in ('HP', 'Dell','Lenovo') and OEMVersion_s <> \"NA\"\r\n| extend ComputerOEMUpdateStatus = iff((parse_version(BiosVersion_s) < parse_version(OEMVersion_s)), \"Update available from OEM\", \"OK\")\r\n| summarize arg_max(TimeGenerated, *) by ManagedDeviceID_g\r\n| summarize count() by ComputerOEMUpdateStatus", 207 | "size": 3, 208 | "timeContext": { 209 | "durationMs": 0 210 | }, 211 | "timeContextFromParameter": "TimeRange", 212 | "queryType": 0, 213 | "resourceType": "microsoft.operationalinsights/workspaces", 214 | "visualization": "piechart", 215 | "chartSettings": { 216 | "seriesLabelSettings": [ 217 | { 218 | "seriesName": "OK", 219 | "color": "green" 220 | }, 221 | { 222 | "seriesName": "Update available from OEM", 223 | "color": "orange" 224 | } 225 | ] 226 | } 227 | }, 228 | "name": "query - 8" 229 | }, 230 | { 231 | "type": 3, 232 | "content": { 233 | "version": "KqlItem/1.0", 234 | "query": "let BIOSDATA = OEMBIOSInformation_CL \r\n| summarize arg_max(TimeGenerated, *) by SKU_s;\r\nDeviceInventory_CL\r\n| join kind=leftouter BIOSDATA on $right.SKU_s == $left.SystemSKU_s\r\n| where OEM_s in ('HP', 'Dell','Lenovo', 'Dell Inc.') and OEMVersion_s <> \"NA\"\r\n| extend ComputerOEMUpdateStatus = iff((parse_version(BiosVersion_s) < parse_version(OEMVersion_s)), \"Update available from OEM\", \"OK\")\r\n| summarize arg_max(TimeGenerated, *) by ManagedDeviceID_g\r\n| project ComputerOEMUpdateStatus, ComputerName_s, OEM_s, Model_s, BiosDate_s, BiosVersion_s, OEMDate_s, OEMVersion_s", 235 | "size": 0, 236 | "title": "BIOS Update Compliance with OEM data", 237 | "timeContext": { 238 | "durationMs": 0 239 | }, 240 | "timeContextFromParameter": "TimeRange", 241 | "queryType": 0, 242 | "resourceType": "microsoft.operationalinsights/workspaces", 243 | "gridSettings": { 244 | "formatters": [ 245 | { 246 | "columnMatch": "ComputerOEMUpdateStatus", 247 | "formatter": 18, 248 | "formatOptions": { 249 | "thresholdsOptions": "icons", 250 | "thresholdsGrid": [ 251 | { 252 | "operator": "regex", 253 | "thresholdValue": "Update available from OEM", 254 | "representation": "2", 255 | "text": "{0}{1}" 256 | }, 257 | { 258 | "operator": "regex", 259 | "thresholdValue": "OK", 260 | "representation": "success", 261 | "text": "{0}{1}" 262 | }, 263 | { 264 | "operator": "Default", 265 | "thresholdValue": null, 266 | "representation": "unknown", 267 | "text": "{0}{1}" 268 | } 269 | ] 270 | } 271 | }, 272 | { 273 | "columnMatch": "OEMDate_s", 274 | "formatter": 18, 275 | "formatOptions": { 276 | "thresholdsOptions": "colors", 277 | "thresholdsGrid": [ 278 | { 279 | "operator": "regex", 280 | "thresholdValue": "NA", 281 | "representation": "red", 282 | "text": "{0}{1}" 283 | }, 284 | { 285 | "operator": "Default", 286 | "thresholdValue": null, 287 | "text": "{0}{1}" 288 | } 289 | ] 290 | } 291 | }, 292 | { 293 | "columnMatch": "OEMVersion_s", 294 | "formatter": 18, 295 | "formatOptions": { 296 | "thresholdsOptions": "colors", 297 | "thresholdsGrid": [ 298 | { 299 | "operator": "regex", 300 | "thresholdValue": "NA", 301 | "representation": "red", 302 | "text": "{0}{1}" 303 | }, 304 | { 305 | "operator": "Default", 306 | "thresholdValue": null, 307 | "text": "{0}{1}" 308 | } 309 | ] 310 | } 311 | }, 312 | { 313 | "columnMatch": "ComputerCompliance", 314 | "formatter": 18, 315 | "formatOptions": { 316 | "thresholdsOptions": "icons", 317 | "thresholdsGrid": [ 318 | { 319 | "operator": "regex", 320 | "thresholdValue": "Update Published", 321 | "representation": "2", 322 | "text": "{0}{1}" 323 | }, 324 | { 325 | "operator": "regex", 326 | "thresholdValue": "OK", 327 | "representation": "success", 328 | "text": "{0}{1}" 329 | }, 330 | { 331 | "operator": "Default", 332 | "thresholdValue": null, 333 | "representation": "unknown", 334 | "text": "{0}{1}" 335 | } 336 | ] 337 | } 338 | }, 339 | { 340 | "columnMatch": "XMLStatus", 341 | "formatter": 18, 342 | "formatOptions": { 343 | "thresholdsOptions": "icons", 344 | "thresholdsGrid": [ 345 | { 346 | "operator": "regex", 347 | "thresholdValue": "Verify and update XML", 348 | "representation": "2", 349 | "text": "{0}{1}" 350 | }, 351 | { 352 | "operator": "regex", 353 | "thresholdValue": "OK", 354 | "representation": "success", 355 | "text": "{0}{1}" 356 | }, 357 | { 358 | "operator": "Default", 359 | "thresholdValue": null, 360 | "representation": "unknown", 361 | "text": "{0}{1}" 362 | } 363 | ] 364 | } 365 | } 366 | ], 367 | "sortBy": [ 368 | { 369 | "itemKey": "$gen_thresholds_ComputerOEMUpdateStatus_0", 370 | "sortOrder": 2 371 | } 372 | ] 373 | }, 374 | "sortBy": [ 375 | { 376 | "itemKey": "$gen_thresholds_ComputerOEMUpdateStatus_0", 377 | "sortOrder": 2 378 | } 379 | ] 380 | }, 381 | "name": "query - 6" 382 | }, 383 | { 384 | "type": 3, 385 | "content": { 386 | "version": "KqlItem/1.0", 387 | "query": "let BIOSDATA = OEMBIOSInformation_CL \r\n| summarize arg_max(TimeGenerated, *) by SKU_s;\r\nDeviceInventory_CL\r\n| join kind=leftouter BIOSDATA on $right.SKU_s == $left.SystemSKU_s\r\n| where OEM_s in ('HP', 'Dell','Lenovo', 'Dell Inc.') and OEMVersion_s <> \"NA\" and todatetime(BiosDate_s) < ago(365d)\r\n| extend ComputerOEMUpdateStatus = iff((parse_version(BiosVersion_s) < parse_version(OEMVersion_s)), \"Update available from OEM\", \"OK\")\r\n| where ComputerOEMUpdateStatus <> \"OK\"\r\n| summarize arg_max(TimeGenerated, *) by ManagedDeviceID_g\r\n| project ComputerOEMUpdateStatus, ComputerName_s, OEM_s, Model_s, todatetime(BiosDate_s), BiosVersion_s, OEMDate_s, OEMVersion_s\r\n| sort by todatetime(BiosDate_s)", 388 | "size": 0, 389 | "title": "Computer with older BIOS than 1 year and newer BIOS exists", 390 | "timeContext": { 391 | "durationMs": 2592000000 392 | }, 393 | "showExportToExcel": true, 394 | "queryType": 0, 395 | "resourceType": "microsoft.operationalinsights/workspaces", 396 | "visualization": "table", 397 | "gridSettings": { 398 | "formatters": [ 399 | { 400 | "columnMatch": "BiosDate_s", 401 | "formatter": 6 402 | } 403 | ], 404 | "sortBy": [ 405 | { 406 | "itemKey": "$gen_heatmap_BiosDate_s_4", 407 | "sortOrder": 2 408 | } 409 | ], 410 | "labelSettings": [ 411 | { 412 | "columnId": "ComputerOEMUpdateStatus", 413 | "label": "Status" 414 | }, 415 | { 416 | "columnId": "ComputerName_s", 417 | "label": "ComputerName" 418 | }, 419 | { 420 | "columnId": "OEM_s", 421 | "label": "OEM" 422 | }, 423 | { 424 | "columnId": "Model_s", 425 | "label": "Model" 426 | }, 427 | { 428 | "columnId": "BiosDate_s", 429 | "label": "BIOSDate" 430 | }, 431 | { 432 | "columnId": "BiosVersion_s", 433 | "label": "BIOSVer" 434 | }, 435 | { 436 | "columnId": "OEMDate_s", 437 | "label": "OEMDate" 438 | }, 439 | { 440 | "columnId": "OEMVersion_s", 441 | "label": "OEMVer" 442 | } 443 | ] 444 | }, 445 | "sortBy": [ 446 | { 447 | "itemKey": "$gen_heatmap_BiosDate_s_4", 448 | "sortOrder": 2 449 | } 450 | ] 451 | }, 452 | "name": "query - 9" 453 | }, 454 | { 455 | "type": 3, 456 | "content": { 457 | "version": "KqlItem/1.0", 458 | "query": "DeviceInventory_CL\r\n| where Manufacturer_s != \"System manufacturer\"\r\n| summarize arg_max(TimeGenerated, *) by ManagedDeviceID_g\r\n| summarize dcount(Model_s) by Manufacturer_s\r\n\r\n\r\n", 459 | "size": 3, 460 | "title": "All Intune Models from Inventory", 461 | "timeContext": { 462 | "durationMs": 2592000000 463 | }, 464 | "queryType": 0, 465 | "resourceType": "microsoft.operationalinsights/workspaces", 466 | "visualization": "tiles", 467 | "tileSettings": { 468 | "titleContent": { 469 | "columnMatch": "Manufacturer_s", 470 | "formatter": 1 471 | }, 472 | "leftContent": { 473 | "columnMatch": "dcount_Model_s", 474 | "formatter": 12, 475 | "formatOptions": { 476 | "palette": "auto" 477 | }, 478 | "numberFormat": { 479 | "unit": 17, 480 | "options": { 481 | "style": "decimal", 482 | "maximumFractionDigits": 2, 483 | "maximumSignificantDigits": 3 484 | } 485 | } 486 | }, 487 | "showBorder": false 488 | } 489 | }, 490 | "name": "query - 10" 491 | } 492 | ], 493 | "fallbackResourceIds": [ 494 | "/subscriptions/c41ddbc0-067b-4586-9b0d-1ea737ad2986/resourceGroups/IntuneRelated/providers/Microsoft.OperationalInsights/workspaces/IntuneComputersLog" 495 | ], 496 | "$schema": "https://github.com/Microsoft/Application-Insights-Workbooks/blob/master/schema/workbook.json" 497 | } -------------------------------------------------------------------------------- /Workbooks/IntuneAuditEventDetails.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "Notebook/1.0", 3 | "items": [ 4 | { 5 | "type": 9, 6 | "content": { 7 | "version": "KqlParameterItem/1.0", 8 | "parameters": [ 9 | { 10 | "id": "43d39a45-75e2-4fa1-b5c9-a395d9454684", 11 | "version": "KqlParameterItem/1.0", 12 | "name": "AuditEventID", 13 | "type": 1, 14 | "timeContext": { 15 | "durationMs": 86400000 16 | }, 17 | "value": "" 18 | }, 19 | { 20 | "id": "ea72df7f-38ac-4ad1-9eb0-d8150d6c9a7b", 21 | "version": "KqlParameterItem/1.0", 22 | "name": "TimeRange", 23 | "type": 4, 24 | "typeSettings": { 25 | "selectableValues": [ 26 | { 27 | "durationMs": 300000 28 | }, 29 | { 30 | "durationMs": 900000 31 | }, 32 | { 33 | "durationMs": 1800000 34 | }, 35 | { 36 | "durationMs": 3600000 37 | }, 38 | { 39 | "durationMs": 14400000 40 | }, 41 | { 42 | "durationMs": 43200000 43 | }, 44 | { 45 | "durationMs": 86400000 46 | }, 47 | { 48 | "durationMs": 172800000 49 | }, 50 | { 51 | "durationMs": 259200000 52 | }, 53 | { 54 | "durationMs": 604800000 55 | }, 56 | { 57 | "durationMs": 1209600000 58 | }, 59 | { 60 | "durationMs": 2419200000 61 | }, 62 | { 63 | "durationMs": 2592000000 64 | }, 65 | { 66 | "durationMs": 5184000000 67 | }, 68 | { 69 | "durationMs": 7776000000 70 | } 71 | ], 72 | "allowCustom": true 73 | }, 74 | "value": { 75 | "durationMs": 7776000000 76 | } 77 | }, 78 | { 79 | "id": "a5e9420e-8c51-4bf3-b648-fe6820556d49", 80 | "version": "KqlParameterItem/1.0", 81 | "name": "TargetID", 82 | "type": 1 83 | }, 84 | { 85 | "id": "37845fd4-8ac3-433b-ba5b-0c8c16e9513e", 86 | "version": "KqlParameterItem/1.0", 87 | "name": "Target", 88 | "type": 1, 89 | "timeContext": { 90 | "durationMs": 0 91 | }, 92 | "timeContextFromParameter": "TimeRange", 93 | "value": "" 94 | }, 95 | { 96 | "id": "4eb1ae67-4a85-4f13-8653-fad144005a45", 97 | "version": "KqlParameterItem/1.0", 98 | "name": "User", 99 | "type": 1 100 | }, 101 | { 102 | "id": "a2ea1813-322c-4735-b628-f044320d407d", 103 | "version": "KqlParameterItem/1.0", 104 | "name": "Time", 105 | "type": 1 106 | }, 107 | { 108 | "id": "b7293100-3d8b-4a1d-93d6-6b29d7a9bc69", 109 | "version": "KqlParameterItem/1.0", 110 | "name": "Operation", 111 | "type": 1 112 | }, 113 | { 114 | "id": "a3098bbf-af8f-413c-b939-684389b8d453", 115 | "version": "KqlParameterItem/1.0", 116 | "name": "OperationType", 117 | "type": 1, 118 | "query": "IntuneAuditLogs\n| where parse_json(Properties).AuditEventId == tostring(\"{AuditEventID}\")\n| project OperationName\n", 119 | "timeContext": { 120 | "durationMs": 0 121 | }, 122 | "timeContextFromParameter": "TimeRange", 123 | "queryType": 0, 124 | "resourceType": "microsoft.operationalinsights/workspaces" 125 | }, 126 | { 127 | "id": "dbe2a317-2911-4df4-b712-e771a3fb2a7f", 128 | "version": "KqlParameterItem/1.0", 129 | "name": "ActionType", 130 | "type": 1, 131 | "query": "IntuneAuditLogs\r\n| where parse_json(Properties).AuditEventId == (\"{AuditEventID}\")\r\n| extend EventType = iif(OperationName has \"retire\" or OperationName has \"wipe\" or OperationName has \"delete\",\"Warn\",iif(OperationName has \"patch\",\"Update\",\"Info\"))\r\n| project EventType\r\n", 132 | "timeContext": { 133 | "durationMs": 0 134 | }, 135 | "timeContextFromParameter": "TimeRange", 136 | "queryType": 0, 137 | "resourceType": "microsoft.operationalinsights/workspaces" 138 | }, 139 | { 140 | "id": "e9afcabf-e810-4e99-a4b8-5ed2f9c5f4b6", 141 | "version": "KqlParameterItem/1.0", 142 | "name": "APIPermissions", 143 | "label": "API Permissions", 144 | "type": 1, 145 | "query": "IntuneAuditLogs\r\n| where parse_json(Properties).AuditEventId == (\"{AuditEventID}\")\r\n| extend APIPermissions = tostring(parse_json(tostring(parse_json(tostring(parse_json(Properties).Actor)).UserPermissions))[0])\r\n| project APIPermissions", 146 | "timeContext": { 147 | "durationMs": 0 148 | }, 149 | "timeContextFromParameter": "TimeRange", 150 | "queryType": 0, 151 | "resourceType": "microsoft.operationalinsights/workspaces" 152 | }, 153 | { 154 | "id": "ff805a16-4249-4db5-b89f-172c00ec8d8e", 155 | "version": "KqlParameterItem/1.0", 156 | "name": "AuditType", 157 | "type": 1, 158 | "timeContext": { 159 | "durationMs": 0 160 | }, 161 | "timeContextFromParameter": "TimeRange" 162 | } 163 | ], 164 | "style": "pills", 165 | "queryType": 0, 166 | "resourceType": "microsoft.operationalinsights/workspaces" 167 | }, 168 | "conditionalVisibility": { 169 | "parameterName": "ShowParams", 170 | "comparison": "isEqualTo", 171 | "value": "True" 172 | }, 173 | "name": "Audit Event Params" 174 | }, 175 | { 176 | "type": 12, 177 | "content": { 178 | "version": "NotebookGroup/1.0", 179 | "groupType": "editable", 180 | "items": [ 181 | { 182 | "type": 1, 183 | "content": { 184 | "json": "## Audit Event Details\n\nBelow are details of the {Target} action initiated against {TargetID}", 185 | "style": "warning" 186 | }, 187 | "conditionalVisibility": { 188 | "parameterName": "ActionType", 189 | "comparison": "isEqualTo", 190 | "value": "Warn" 191 | }, 192 | "name": "Create Notice -Warning" 193 | }, 194 | { 195 | "type": 1, 196 | "content": { 197 | "json": "## Audit Event Details\n\nBelow are details of the {Target} action initiated against {TargetID}", 198 | "style": "info" 199 | }, 200 | "conditionalVisibility": { 201 | "parameterName": "ActionType", 202 | "comparison": "isEqualTo", 203 | "value": "Info" 204 | }, 205 | "name": "Create Notice - Sync" 206 | }, 207 | { 208 | "type": 1, 209 | "content": { 210 | "json": "## Audit Event Details\n\nBelow are details of the {Target} action initiated against {TargetID}", 211 | "style": "success" 212 | }, 213 | "conditionalVisibility": { 214 | "parameterName": "ActionType", 215 | "comparison": "isEqualTo", 216 | "value": "Update" 217 | }, 218 | "name": "Create Notice - Update" 219 | }, 220 | { 221 | "type": 1, 222 | "content": { 223 | "json": "\r\n\r\n \r\n \r\n \r\n\r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n\r\n
Audit Event Information
Target{Operation}
Application{User}
API Permissions{APIPermissions}
Time{Time}
Audit Event ID{AuditEventID}
" 224 | }, 225 | "conditionalVisibility": { 226 | "parameterName": "AuditType", 227 | "comparison": "isEqualTo", 228 | "value": "AppRegistration" 229 | }, 230 | "name": "Policy Change Summary - App", 231 | "styleSettings": { 232 | "margin": "10px", 233 | "padding": "10px" 234 | } 235 | }, 236 | { 237 | "type": 1, 238 | "content": { 239 | "json": "\r\n\r\n \r\n \r\n \r\n\r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n\r\n
Audit Event Information
Target{Operation}
Administrative User{User}
Time{Time}
Audit Event ID{AuditEventID}
" 240 | }, 241 | "conditionalVisibility": { 242 | "parameterName": "AuditType", 243 | "comparison": "isEqualTo", 244 | "value": "AdminUser" 245 | }, 246 | "name": "Policy Change Summary ", 247 | "styleSettings": { 248 | "margin": "10px", 249 | "padding": "10px" 250 | } 251 | }, 252 | { 253 | "type": 3, 254 | "content": { 255 | "version": "KqlItem/1.0", 256 | "query": "IntuneAuditLogs\r\n| where parse_json(Properties).AuditEventId == \"{AuditEventID}\"\r\n| extend Settings = (parse_json(tostring(parse_json(tostring(parse_json(Properties).Targets))[0].ModifiedProperties)))\r\n| extend Target = (parse_json(tostring(parse_json(tostring(parse_json(Properties).Targets))[1].ModifiedProperties)))\r\n| extend TargetObjectID = tostring(parse_json(tostring(parse_json(Properties).TargetObjectIds))[0])\r\n| extend TargetDisplayName = tostring(parse_json(tostring(parse_json(Properties).TargetDisplayNames))[0])\r\n| extend UserPrincipalName = tostring(parse_json(tostring(parse_json(Properties).Actor)).UPN)\r\n| project Settings, Target, TargetObjectID, TargetDisplayName, OperationName\r\n| mv-expand Settings, Target\r\n| evaluate bag_unpack(Settings)\r\n| evaluate bag_unpack(Target)\r\n| extend OldValues = \"null\"\r\n| project OperationName, Name, TargetDisplayName, New, column_ifexists(\"Old\",[\"Old\"] = OldValues)\r\n", 257 | "size": 3, 258 | "title": "Audit Event Details", 259 | "color": "blue", 260 | "timeContextFromParameter": "TimeRange", 261 | "queryType": 0, 262 | "resourceType": "microsoft.operationalinsights/workspaces", 263 | "visualization": "table", 264 | "tileSettings": { 265 | "showBorder": false 266 | } 267 | }, 268 | "name": "Audit Event Details", 269 | "styleSettings": { 270 | "margin": "10px", 271 | "padding": "10px" 272 | } 273 | } 274 | ] 275 | }, 276 | "conditionalVisibility": { 277 | "parameterName": "ActionType", 278 | "comparison": "isNotEqualTo" 279 | }, 280 | "name": "Policy Change Details", 281 | "styleSettings": { 282 | "showBorder": true 283 | } 284 | } 285 | ], 286 | "$schema": "https://github.com/Microsoft/Application-Insights-Workbooks/blob/master/schema/workbook.json" 287 | } --------------------------------------------------------------------------------