├── Approval-Manager.ps1 ├── Change-SiteName.ps1 ├── EL22_Enhance-Microsoft-Intune-data-with-Log-Analytics.pdf ├── EL23_Never-forget-another-Microsoft-Intune-administrative-task-by-using-low-code-solutions.pdf ├── EL24_Protecting-corporate-data-on-personal-Windows-devices - Your-options.pdf ├── EL25_Protecting-your-corporate-data-on-managed-Windows-devices - Your-options.pdf ├── ELEU24_Protecting-corporate-data-on-personal-Windows-devices - Your-options.pdf ├── Get-ComputerTargetedApplications.ps1 ├── Get-ObjectLocation.ps1 ├── Get-SoftwareUpdateInformation.ps1 ├── Get-UserTargetedApplications.ps1 ├── Import-ComputerForm.ps1 ├── Invoke-LocalAdminInventory.ps1 ├── Local administrators inventory.workbook ├── MEMS24_Protecting-corporate-data-on-personal-Windows-devices - Your-options.pdf ├── MEMS24_Simplify-device-management-with-data-and-AI.pdf ├── Manage-MobileDevice.ps1 ├── MyMobileDeviceManagerApp_20210323140715.zip ├── NVS_Getting-access-to-on-premises-apps-and-resources-with-Microsoft-Tunnel.pdf ├── NVS_Simplifying-repetitive-administrative-tasks-by-using-low-code-solutions.pdf ├── NVS_Welcome-in-the-Android-Enterprise-device-management-jungle.pdf ├── README.md ├── Show-CollectionDetails.ps1 ├── Show-DependentApplications.ps1 ├── Uninstall-IntuneClient.ps1 ├── Update compliance information.workbook ├── WPNS22_Creating-the-path-for-mobile-devices-to-on-premises-resources.pdf ├── WPNS22_Welcome-to-the-still-growing-Android-device-management-jungle.pdf ├── WPNinjas_Getting-to-know-the-Windows-10-MDM-WMI-Bridge-provider.pdf ├── WPNinjas_Why-you-might-want-to-use-corporate-owned-devices-with-Work-Profile.pdf └── Windows - Default secure WSL configuration.json /Approval-Manager.ps1: -------------------------------------------------------------------------------- 1 | ################################################################################################################################################################### 2 | # Project: Application Approval Manager 3 | # Date: 2-5-2013 4 | # By: Peter van der Woude 5 | # Version: 0.8 Public 6 | # Usage: PowerShell.exe -ExecutionPolicy ByPass .\Approval-Manager.ps1 -CollectionID -SiteCode -SiteServer -EnableAlert 7 | ################################################################################################################################################################### 8 | [CmdletBinding()] 9 | 10 | param ( 11 | [string]$CollectionID, 12 | [string]$SiteCode, 13 | [string]$SiteServer, 14 | [switch]$EnableAlert, 15 | [string]$ApplicationVersion = "Approval Manager v0.8p" 16 | ) 17 | 18 | #Function to get the users from a specific collection 19 | function Get-UsersFromCM { 20 | $Users = Get-WmiObject -Class SMS_FullCollectionMembership -Namespace root/SMS/site_$($SiteCode) -ComputerName $SiteServer | Where-Object -FilterScript {$_.CollectionId -eq $CollectionID} | Select-Object SMSID 21 | foreach ($User in $Users) { 22 | $comboBox1.Items.add($User.SMSID) 23 | } 24 | } 25 | 26 | #Function to display the approval requests in a form 27 | function Show-ApprovalRequest { 28 | $User = $comboBox1.SelectedItem 29 | if($checkbox1.Checked) { 30 | $Requests = Get-WmiObject -Class SMS_UserApplicationRequest -Namespace root/SMS/site_$($SiteCode) -ComputerName $SiteServer | Where-Object -FilterScript {$_.User -eq $User} | Where-Object -FilterScript {$_.CurrentState -eq 1} | Select-Object Application,CurrentState,User 31 | } 32 | else { 33 | $Requests = Get-WmiObject -Class SMS_UserApplicationRequest -Namespace root/SMS/site_$($SiteCode) -ComputerName $SiteServer | Where-Object -FilterScript {$_.User -eq $User} | Select-Object Application,CurrentState,User 34 | } 35 | 36 | $Array = New-Object System.Collections.ArrayList 37 | if ($Requests -eq $null) { 38 | $dataGridView1.DataSource = $null 39 | $form1.refresh() 40 | [Windows.Forms.MessageBox]::Show(“There are no requests for this user”, “$ApplicationVersion”, [Windows.Forms.MessageBoxButtons]::OK, [Windows.Forms.MessageBoxIcon]::Information) 41 | } 42 | else { 43 | for ($i=0; $i -lt @($Requests).Count; $i++) { 44 | if ($Requests[$i].CurrentState -eq 1) { 45 | $Requests[$i].CurrentState = "Pending Approval" 46 | $checkbox1.Enabled = $true 47 | } 48 | elseif ($Requests[$i].CurrentState -eq 2) { 49 | $Requests[$i].CurrentState = "Cancelled" 50 | } 51 | elseif ($Requests[$i].CurrentState -eq 3) { 52 | $Requests[$i].CurrentState = "Denied" 53 | } 54 | elseif ($Requests[$i].CurrentState -eq 4) { 55 | $Requests[$i].CurrentState = "Approved" 56 | } 57 | } 58 | foreach ($Request in $Requests) { 59 | $Array.Add($Request) 60 | } 61 | $dataGridView1.DataSource = $Array 62 | for ($i=0; $i -lt $dataGridView1.ColumnCount; $i++) { 63 | $dataGridView1.Columns[$i].width = 161 64 | } 65 | $form1.refresh() 66 | } 67 | } 68 | 69 | #Function to display the pending approval requests in a popup 70 | function Get-PendingApprovalRequest { 71 | $Array = New-Object System.Collections.ArrayList 72 | $Users = Get-WmiObject -Class SMS_FullCollectionMembership -Namespace root/SMS/site_$($SiteCode) -ComputerName $SiteServer | Where-Object -FilterScript {$_.CollectionId -eq $CollectionID} | Select-Object SMSID 73 | foreach ($User in $Users) { 74 | $Requests = Get-WmiObject -Class SMS_UserApplicationRequest -Namespace root/SMS/site_$($SiteCode) -ComputerName $SiteServer | Where-Object -FilterScript {$_.User -eq $User.SMSID} | Where-Object -FilterScript {$_.CurrentState -eq 1} | Select-Object Application,CurrentState,User 75 | foreach ($Request in $Requests) { 76 | $Array.Add($Request) 77 | } 78 | } 79 | if ($Array.Count -le 0) { 80 | [Windows.Forms.MessageBox]::Show(“There are no requests pending approval”, “$ApplicationVersion”, [Windows.Forms.MessageBoxButtons]::OK, [Windows.Forms.MessageBoxIcon]::Information) 81 | } 82 | else { 83 | $TempPendingUsers = "" 84 | $PendingUsers = "The following users have pending approval requests: `n" 85 | for ($i=0; $i -lt $Array.Count; $i++) { 86 | if ($TempPendingUsers -ne $Array[$i].User) { 87 | $TempPendingUsers = $Array[$i].User 88 | $PendingUsers = "$PendingUsers $TempPendingUsers `n" 89 | } 90 | } 91 | [Windows.Forms.MessageBox]::Show(“$PendingUsers", “$ApplicationVersion”, [Windows.Forms.MessageBoxButtons]::OK, [Windows.Forms.MessageBoxIcon]::Information) 92 | } 93 | } 94 | 95 | #Function to approve/deny the approval request 96 | function Set-ApprovalRequest { 97 | param ( 98 | [string]$Action 99 | ) 100 | $User = $comboBox1.SelectedItem 101 | $Index = $dataGridView1.CurrentCell.RowIndex 102 | if($checkbox1.Checked) { 103 | $Requests = Get-WmiObject -Class SMS_UserApplicationRequest -Namespace root/SMS/site_$($SiteCode) -ComputerName $SiteServer | Where-Object -FilterScript {$_.User -eq $User} | Where-Object -FilterScript {$_.CurrentState -eq 1} | Select-Object Application,CurrentState,User 104 | } 105 | else { 106 | $Requests = Get-WmiObject -Class SMS_UserApplicationRequest -Namespace root/SMS/site_$($SiteCode) -ComputerName $SiteServer | Where-Object -FilterScript {$_.User -eq $User} | Select-Object Application,CurrentState,User 107 | } 108 | 109 | if (($ApplName=$Requests[$Index].Application)) { 110 | if ($Requests[$Index].CurrentState -eq 3) { 111 | [Windows.Forms.MessageBox]::Show(“This request is already denied”, “$ApplicationVersion”, [Windows.Forms.MessageBoxButtons]::OK, [Windows.Forms.MessageBoxIcon]::Information) 112 | } 113 | elseif ($Requests[$Index].CurrentState -eq 2) { 114 | [Windows.Forms.MessageBox]::Show(“This request is already cancelled”, “$ApplicationVersion”, [Windows.Forms.MessageBoxButtons]::OK, [Windows.Forms.MessageBoxIcon]::Information) 115 | } 116 | elseif ($Requests[$Index].CurrentState -eq 4) { 117 | [Windows.Forms.MessageBox]::Show(“This request is already approved”, “$ApplicationVersion”, [Windows.Forms.MessageBoxButtons]::OK, [Windows.Forms.MessageBoxIcon]::Information) 118 | } 119 | else { 120 | If ($Action -eq "Approve") { 121 | $ApplAppr = Get-WmiObject -Class SMS_UserApplicationRequest -Namespace root/SMS/site_$($SiteCode) -ComputerName $SiteServer | Where-Object -FilterScript {$_.User -eq $User} | Where-Object -FilterScript {$_.Application -eq $ApplName} 122 | $ApplAppr.Approve('Request approved') 123 | } 124 | else { 125 | $ApplAppr = Get-WmiObject -Class SMS_UserApplicationRequest -Namespace root/SMS/site_$($SiteCode) -ComputerName $SiteServer | Where-Object -FilterScript {$_.User -eq $User} | Where-Object -FilterScript {$_.Application -eq $ApplName} 126 | $ApplAppr.Deny('Request denied') 127 | } 128 | } 129 | } 130 | } 131 | 132 | #Generated Form Function 133 | function GenerateForm { 134 | ######################################################################## 135 | # Code Generated By: SAPIEN Technologies PrimalForms (Community Edition) v1.0.10.0 136 | # Generated On: 5-3-2013 13:04 137 | # Generated By: Peter van der Woude 138 | ######################################################################## 139 | 140 | [reflection.assembly]::loadwithpartialname("System.Windows.Forms") | Out-Null 141 | [reflection.assembly]::loadwithpartialname("System.Drawing") | Out-Null 142 | 143 | $form1 = New-Object System.Windows.Forms.Form 144 | $button1 = New-Object System.Windows.Forms.Button 145 | $button2 = New-Object System.Windows.Forms.Button 146 | $button3 = New-Object System.Windows.Forms.Button 147 | $checkBox1 = New-Object System.Windows.Forms.CheckBox 148 | $comboBox1 = New-Object System.Windows.Forms.ComboBox 149 | $dataGridView1 = New-Object System.Windows.Forms.DataGridView 150 | $label1 = New-Object System.Windows.Forms.Label 151 | $label2 = New-Object System.Windows.Forms.Label 152 | $label3 = New-Object System.Windows.Forms.Label 153 | $linkLabel1 = New-Object System.Windows.Forms.LinkLabel 154 | $linkLabel2 = New-Object System.Windows.Forms.LinkLabel 155 | $timer1 = New-Object System.Windows.Forms.Timer 156 | $InitialFormWindowState = New-Object System.Windows.Forms.FormWindowState 157 | 158 | $button1_OnClick= { 159 | $Action = "Approve" 160 | Set-ApprovalRequest $Action 161 | Show-ApprovalRequest 162 | } 163 | 164 | $button2_OnClick= { 165 | $timer1.Enabled = $false 166 | $form1.Close() 167 | } 168 | 169 | $button3_OnClick= { 170 | $Action = "Deny" 171 | Set-ApprovalRequest $Action 172 | Show-ApprovalRequest 173 | } 174 | 175 | $checkbox1_OnStateChanged= { 176 | Show-ApprovalRequest 177 | } 178 | 179 | $comboBox1_OnChange= { 180 | $checkbox1.Checked = $false 181 | $checkbox1.Enabled = $false 182 | Show-ApprovalRequest 183 | } 184 | 185 | $linkLabel1_OpenLink= { 186 | [system.Diagnostics.Process]::start($linkLabel1.text) 187 | } 188 | 189 | $linkLabel2_OpenLink= { 190 | [system.Diagnostics.Process]::start("http://twitter.com/pvanderwoude") 191 | } 192 | 193 | $timer1_OnTick= { 194 | $timer1.Enabled = $false 195 | Get-PendingApprovalRequest 196 | $timer1.Enabled = $true 197 | } 198 | 199 | $OnLoadForm_UpdateGrid= { 200 | Get-UsersFromCM 201 | } 202 | 203 | #Create form1 204 | $System_Drawing_Size = New-Object System.Drawing.Size 205 | $System_Drawing_Size.Height = 554 206 | $System_Drawing_Size.Width = 554 207 | $form1.ClientSize = $System_Drawing_Size 208 | $form1.DataBindings.DefaultDataSourceUpdateMode = 0 209 | $form1.Name = "form1" 210 | $form1.Text = "$ApplicationVersion - P.T. van der Woude" 211 | 212 | #Create button1 213 | $button1.DataBindings.DefaultDataSourceUpdateMode = 0 214 | $System_Drawing_Point = New-Object System.Drawing.Point 215 | $System_Drawing_Point.X = 13 216 | $System_Drawing_Point.Y = 496 217 | $button1.Location = $System_Drawing_Point 218 | $button1.Name = "button1" 219 | $System_Drawing_Size = New-Object System.Drawing.Size 220 | $System_Drawing_Size.Height = 23 221 | $System_Drawing_Size.Width = 150 222 | $button1.Size = $System_Drawing_Size 223 | $button1.TabIndex = 0 224 | $button1.Text = "Approve" 225 | $button1.UseVisualStyleBackColor = $True 226 | $button1.add_Click($button1_OnClick) 227 | $form1.Controls.Add($button1) 228 | 229 | #Create button2 230 | $button2.DataBindings.DefaultDataSourceUpdateMode = 0 231 | $System_Drawing_Point = New-Object System.Drawing.Point 232 | $System_Drawing_Point.X = 392 233 | $System_Drawing_Point.Y = 496 234 | $button2.Location = $System_Drawing_Point 235 | $button2.Name = "button2" 236 | $System_Drawing_Size = New-Object System.Drawing.Size 237 | $System_Drawing_Size.Height = 23 238 | $System_Drawing_Size.Width = 150 239 | $button2.Size = $System_Drawing_Size 240 | $button2.TabIndex = 1 241 | $button2.Text = "Close" 242 | $button2.UseVisualStyleBackColor = $True 243 | $button2.add_Click($button2_OnClick) 244 | $form1.Controls.Add($button2) 245 | 246 | #Create button3 247 | $button3.DataBindings.DefaultDataSourceUpdateMode = 0 248 | $System_Drawing_Point = New-Object System.Drawing.Point 249 | $System_Drawing_Point.X = 205 250 | $System_Drawing_Point.Y = 496 251 | $button3.Location = $System_Drawing_Point 252 | $button3.Name = "button3" 253 | $System_Drawing_Size = New-Object System.Drawing.Size 254 | $System_Drawing_Size.Height = 23 255 | $System_Drawing_Size.Width = 150 256 | $button3.Size = $System_Drawing_Size 257 | $button3.TabIndex = 2 258 | $button3.Text = "Deny" 259 | $button3.UseVisualStyleBackColor = $True 260 | $button3.add_Click($button3_OnClick) 261 | $form1.Controls.Add($button3) 262 | 263 | #Create checkbox1 264 | $checkBox1.DataBindings.DefaultDataSourceUpdateMode = 0 265 | $System_Drawing_Point = New-Object System.Drawing.Point 266 | $System_Drawing_Point.X = 13 267 | $System_Drawing_Point.Y = 39 268 | $checkBox1.Location = $System_Drawing_Point 269 | $checkBox1.Name = "checkBox1" 270 | $System_Drawing_Size = New-Object System.Drawing.Size 271 | $System_Drawing_Size.Height = 24 272 | $System_Drawing_Size.Width = 253 273 | $checkBox1.Size = $System_Drawing_Size 274 | $checkBox1.TabIndex = 3 275 | $checkBox1.Text = "Show only applications waiting for approval" 276 | $checkBox1.UseVisualStyleBackColor = $True 277 | $checkbox1.Enabled = $false 278 | $checkbox1.Add_CheckStateChanged($checkbox1_OnStateChanged) 279 | $form1.Controls.Add($checkBox1) 280 | 281 | #Create combobox1 282 | $comboBox1.DataBindings.DefaultDataSourceUpdateMode = 0 283 | $comboBox1.FormattingEnabled = $True 284 | $System_Drawing_Point = New-Object System.Drawing.Point 285 | $System_Drawing_Point.X = 366 286 | $System_Drawing_Point.Y = 39 287 | $comboBox1.Location = $System_Drawing_Point 288 | $comboBox1.Name = "comboBox1" 289 | $System_Drawing_Size = New-Object System.Drawing.Size 290 | $System_Drawing_Size.Height = 17 291 | $System_Drawing_Size.Width = 175 292 | $comboBox1.Size = $System_Drawing_Size 293 | $comboBox1.Text = "Select user:" 294 | $comboBox1.TabIndex = 0 295 | $comboBox1.Add_SelectedIndexChanged($comboBox1_OnChange) 296 | $form1.Controls.Add($comboBox1) 297 | 298 | #Create $dataGridView1 299 | $dataGridView1.DataBindings.DefaultDataSourceUpdateMode = 0 300 | $System_Drawing_Point = New-Object System.Drawing.Point 301 | $System_Drawing_Point.X = 13 302 | $System_Drawing_Point.Y = 69 303 | $dataGridView1.Location = $System_Drawing_Point 304 | $dataGridView1.MultiSelect = $false 305 | $dataGridView1.Name = "dataGridView1" 306 | $System_Drawing_Size = New-Object System.Drawing.Size 307 | $System_Drawing_Size.Height = 419 308 | $System_Drawing_Size.Width = 528 309 | $dataGridView1.ReadOnly = $True 310 | $dataGridView1.SelectionMode = 'FullRowSelect' 311 | $dataGridView1.Size = $System_Drawing_Size 312 | $dataGridView1.TabIndex = 2 313 | $form1.Controls.Add($dataGridView1) 314 | 315 | #Create label1 316 | $label1.DataBindings.DefaultDataSourceUpdateMode = 0 317 | $label1.Font = New-Object System.Drawing.Font("Tahoma",14.25,0,3,0) 318 | $System_Drawing_Point = New-Object System.Drawing.Point 319 | $System_Drawing_Point.X = 13 320 | $System_Drawing_Point.Y = 13 321 | $label1.Location = $System_Drawing_Point 322 | $label1.Name = "label1" 323 | $System_Drawing_Size = New-Object System.Drawing.Size 324 | $System_Drawing_Size.Height = 23 325 | $System_Drawing_Size.Width = 253 326 | $label1.Size = $System_Drawing_Size 327 | $label1.TabIndex = 5 328 | $label1.Text = "Approval Manager" 329 | $form1.Controls.Add($label1) 330 | 331 | #Create label2 332 | $label2.DataBindings.DefaultDataSourceUpdateMode = 0 333 | $label2.Font = New-Object System.Drawing.Font("Tahoma",8.25,0,3,0) 334 | $System_Drawing_Point = New-Object System.Drawing.Point 335 | $System_Drawing_Point.X = 12 336 | $System_Drawing_Point.Y = 529 337 | $label2.Location = $System_Drawing_Point 338 | $label2.Name = "label2" 339 | $System_Drawing_Size = New-Object System.Drawing.Size 340 | $System_Drawing_Size.Height = 23 341 | $System_Drawing_Size.Width = 48 342 | $label2.Size = $System_Drawing_Size 343 | $label2.TabIndex = 1 344 | $label2.Text = "My blog:" 345 | $form1.Controls.Add($label2) 346 | 347 | #Create label3 348 | $label3.DataBindings.DefaultDataSourceUpdateMode = 0 349 | $label3.Font = New-Object System.Drawing.Font("Tahoma",8.25,0,3,0) 350 | $System_Drawing_Point = New-Object System.Drawing.Point 351 | $System_Drawing_Point.X = 335 352 | $System_Drawing_Point.Y = 529 353 | $label3.Location = $System_Drawing_Point 354 | $label3.Name = "label3" 355 | $System_Drawing_Size = New-Object System.Drawing.Size 356 | $System_Drawing_Size.Height = 23 357 | $System_Drawing_Size.Width = 117 358 | $label3.Size = $System_Drawing_Size 359 | $label3.TabIndex = 2 360 | $label3.Text = "Follow me on twitter:" 361 | $form1.Controls.Add($label3) 362 | 363 | #Create linkLabel1 364 | $linkLabel1.DataBindings.DefaultDataSourceUpdateMode = 0 365 | $linkLabel1.Font = New-Object System.Drawing.Font("Tahoma",8.25,0,3,0) 366 | $System_Drawing_Point = New-Object System.Drawing.Point 367 | $System_Drawing_Point.X = 63 368 | $System_Drawing_Point.Y = 529 369 | $linkLabel1.Location = $System_Drawing_Point 370 | $linkLabel1.Name = "linkLabel1" 371 | $System_Drawing_Size = New-Object System.Drawing.Size 372 | $System_Drawing_Size.Height = 23 373 | $System_Drawing_Size.Width = 142 374 | $linkLabel1.Size = $System_Drawing_Size 375 | $linkLabel1.TabIndex = 0 376 | $linkLabel1.TabStop = $True 377 | $linkLabel1.Text = "www.petervanderwoude.nl" 378 | $linkLabel1.add_click($linkLabel1_OpenLink) 379 | $form1.Controls.Add($linkLabel1) 380 | 381 | #Create linkLabel2 382 | $linkLabel2.DataBindings.DefaultDataSourceUpdateMode = 0 383 | $linkLabel2.Font = New-Object System.Drawing.Font("Tahoma",8.25,0,3,0) 384 | $System_Drawing_Point = New-Object System.Drawing.Point 385 | $System_Drawing_Point.X = 449 386 | $System_Drawing_Point.Y = 529 387 | $linkLabel2.Location = $System_Drawing_Point 388 | $linkLabel2.Name = "linkLabel2" 389 | $System_Drawing_Size = New-Object System.Drawing.Size 390 | $System_Drawing_Size.Height = 23 391 | $System_Drawing_Size.Width = 90 392 | $linkLabel2.Size = $System_Drawing_Size 393 | $linkLabel2.TabIndex = 3 394 | $linkLabel2.TabStop = $True 395 | $linkLabel2.Text = "@pvanderwoude" 396 | $linkLabel1.add_click($linkLabel2_OpenLink) 397 | $form1.Controls.Add($linkLabel2) 398 | 399 | #Create timer1 (and enable when the EnableAlert parameter is supplied) 400 | $timer1.Interval = 3600000 #Current interval is set to 3600 minutes (=1 hour) 401 | $timer1.add_Tick($timer1_OnTick) 402 | if ($EnableAlert -eq $True) 403 | { 404 | $timer1.Enabled = $true 405 | } 406 | 407 | $InitialFormWindowState = $form1.WindowState 408 | 409 | $form1.add_Load($OnLoadForm_UpdateGrid) 410 | $form1.ShowDialog()| Out-Null 411 | } 412 | GenerateForm 413 | -------------------------------------------------------------------------------- /Change-SiteName.ps1: -------------------------------------------------------------------------------- 1 | ################################################################################################################################################## 2 | # Project: Change Site Name 3 | # Date: 20-05-2013 4 | # By: Peter van der Woude 5 | # Version: 1.0 Public 6 | # Usage: PowerShell.exe -ExecutionPolicy ByPass .\Change-SiteName.ps1 -SiteCode -SiteServer -SiteName 7 | ################################################################################################################################################## 8 | 9 | [CmdletBinding()] 10 | 11 | param ( 12 | [string]$SiteCode, 13 | [string]$SiteServer, 14 | [string]$SiteName 15 | ) 16 | 17 | function Change-SiteName { 18 | $Site = Get-WmiObject -Class SMS_SCI_SiteDefinition -Namespace root/SMS/site_$($SiteCode) -ComputerName $SiteServer | Where-Object -FilterScript {$_.SiteCode -eq $SiteCode} 19 | $Site.SiteName = $SiteName 20 | $Site.Put() 21 | } 22 | 23 | Change-SiteName 24 | -------------------------------------------------------------------------------- /EL22_Enhance-Microsoft-Intune-data-with-Log-Analytics.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pvanderwoude/blog/4e8fa142e2276796e5ac08bb556a5696ce1fa87c/EL22_Enhance-Microsoft-Intune-data-with-Log-Analytics.pdf -------------------------------------------------------------------------------- /EL23_Never-forget-another-Microsoft-Intune-administrative-task-by-using-low-code-solutions.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pvanderwoude/blog/4e8fa142e2276796e5ac08bb556a5696ce1fa87c/EL23_Never-forget-another-Microsoft-Intune-administrative-task-by-using-low-code-solutions.pdf -------------------------------------------------------------------------------- /EL24_Protecting-corporate-data-on-personal-Windows-devices - Your-options.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pvanderwoude/blog/4e8fa142e2276796e5ac08bb556a5696ce1fa87c/EL24_Protecting-corporate-data-on-personal-Windows-devices - Your-options.pdf -------------------------------------------------------------------------------- /EL25_Protecting-your-corporate-data-on-managed-Windows-devices - Your-options.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pvanderwoude/blog/4e8fa142e2276796e5ac08bb556a5696ce1fa87c/EL25_Protecting-your-corporate-data-on-managed-Windows-devices - Your-options.pdf -------------------------------------------------------------------------------- /ELEU24_Protecting-corporate-data-on-personal-Windows-devices - Your-options.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pvanderwoude/blog/4e8fa142e2276796e5ac08bb556a5696ce1fa87c/ELEU24_Protecting-corporate-data-on-personal-Windows-devices - Your-options.pdf -------------------------------------------------------------------------------- /Get-ComputerTargetedApplications.ps1: -------------------------------------------------------------------------------- 1 | [CmdletBinding()] 2 | 3 | param ( 4 | [string]$ResourceName, 5 | [string]$SiteCode='{YourSiteCode}', 6 | [string]$SiteServer='{YourSiteServer}', 7 | [string]$Container = "{YourApplicationCollectionContainer}" 8 | ) 9 | 10 | function Get-TargetedApplications { 11 | $Count = 1 12 | $TSEnv = New-Object -COMObject Microsoft.SMS.TSEnvironment 13 | $ContainerNodeId = (Get-WmiObject -ComputerName $SiteServer -Class SMS_ObjectContainerNode -Namespace root/SMS/site_$SiteCode -Filter "Name='$Container' and ObjectTypeName='SMS_Collection_Device'").ContainerNodeId 14 | $CollectionIds = (Get-WmiObject -ComputerName $SiteServer -Namespace root/SMS/site_$SiteCode -Query "SELECT fcm.* FROM SMS_FullCollectionMembership fcm, SMS_ObjectContainerItem oci WHERE oci.ContainerNodeID='$ContainerNodeId' AND fcm.Name='$ResourceName' AND fcm.CollectionID=oci.InstanceKey").CollectionId 15 | if ($CollectionIds -ne $null) { 16 | foreach ($CollectionId in $CollectionIds) { 17 | $ApplicationNames = (Get-WmiObject -ComputerName $SiteServer -Class SMS_ApplicationAssignment -Namespace root/SMS/site_$SiteCode -Filter "TargetCollectionID='$CollectionId' and OfferTypeID='0'").ApplicationName 18 | if ($ApplicationNames -ne $null) { 19 | foreach ($ApplicationName in $ApplicationNames) { 20 | $Id = "{0:D2}" -f $Count 21 | $AppId = "APPId$Id" 22 | $TSEnv.Value($AppId) = $ApplicationName 23 | $Count = $Count + 1 24 | Write-Host $AppId $ApplicationName 25 | } 26 | } 27 | } 28 | } 29 | else { 30 | $TSEnv.Value("SkipApplications") = "True" 31 | Write-Host "Skip applications" 32 | break 33 | } 34 | } 35 | 36 | Get-TargetedApplications 37 | -------------------------------------------------------------------------------- /Get-ObjectLocation.ps1: -------------------------------------------------------------------------------- 1 | $SiteCode = "{YourSiteCode}" 2 | $SiteServer = "{YourSiteCode}" 3 | 4 | function Get-ObjectLocation { 5 | param ( 6 | [string]$InstanceKey 7 | ) 8 | 9 | #oci.ObjectTypeName='SMS_Collection_Device' AND 10 | $ContainerNode = Get-WmiObject -Namespace root/SMS/site_$($SiteCode) -ComputerName $SiteServer -Query "SELECT ocn.* FROM SMS_ObjectContainerNode AS ocn JOIN SMS_ObjectContainerItem AS oci ON ocn.ContainerNodeID=oci.ContainerNodeID WHERE oci.InstanceKey='$InstanceKey'" 11 | if ($ContainerNode -ne $null) { 12 | $ObjectFolder = $ContainerNode.Name 13 | if ($ContainerNode.ParentContainerNodeID -eq 0) { 14 | $ParentFolder = $false 15 | } 16 | else { 17 | $ParentFolder = $true 18 | $ParentContainerNodeID = $ContainerNode.ParentContainerNodeID 19 | } 20 | while ($ParentFolder -eq $true) { 21 | $ParentContainerNode = Get-WmiObject -Namespace root/SMS/site_$($SiteCode) -ComputerName $SiteServer -Query "SELECT * FROM SMS_ObjectContainerNode WHERE ContainerNodeID = '$ParentContainerNodeID'" 22 | $ObjectFolder = $ParentContainerNode.Name + "\" + $ObjectFolder 23 | if ($ParentContainerNode.ParentContainerNodeID -eq 0) { 24 | $ParentFolder = $false 25 | } 26 | else { 27 | $ParentContainerNodeID = $ParentContainerNode.ParentContainerNodeID 28 | } 29 | } 30 | $ObjectFolder = "Root\" + $ObjectFolder 31 | Write-Output $ObjectFolder 32 | } 33 | else { 34 | $ObjectFolder = "Root" 35 | Write-Output $ObjectFolder 36 | } 37 | } 38 | 39 | Get-ObjectLocation {YourInstanceKey} 40 | -------------------------------------------------------------------------------- /Get-SoftwareUpdateInformation.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Shows the information about the deployment packages and Software update groups of which asoftware update is a member. 4 | .DESCRIPTION 5 | This script creates a form that requires a article id, a software update group, or a deployment package as input. Based on the input it will show information about 6 | the specific software update, or all the software updates in a software update group, or a deployment package. When used for a software update it will show in which 7 | software update group and deployment package it exists. When used for a software update group it will show in which deployment packages those updates also exists. 8 | When used for a deployment package it will show in which software update groups those updates exist. 9 | .PARAMETER SiteCode 10 | The site code of the primary site. 11 | .PARAMETER SiteServer 12 | The site server of the primary site. 13 | .NOTES 14 | Author: Peter van der Woude - pvanderwoude@hotmail.com 15 | Date published: 19-06-2014 16 | .LINK 17 | http://www.petervanderwoude.nl 18 | .EXAMPLE 19 | Get-SoftwareUpdateInformation.ps1 -SiteCode PCP -SiteServer CLDSRV02 20 | #> 21 | [CmdletBinding()] 22 | 23 | param ( 24 | [string]$SiteCode, 25 | [string]$SiteServer 26 | ) 27 | 28 | #Function to load the form 29 | function Load-Form { 30 | $Form1.Controls.Add($Button1) 31 | $Form1.Controls.Add($Button2) 32 | $Form1.Controls.Add($ComboBox1) 33 | $Form1.Controls.Add($DataGridView1) 34 | $Form1.Controls.Add($DataGridView2) 35 | $Form1.Controls.Add($Label1) 36 | $Form1.Controls.Add($Label2) 37 | $Form1.Controls.Add($LinkLabel1) 38 | $Form1.Controls.Add($LinkLabel2) 39 | $Form1.Controls.Add($TextBox1) 40 | $Form1.Controls.Add($GroupBox1) 41 | $Form1.Controls.Add($GroupBox2) 42 | $Form1.Controls.Add($GroupBox3) 43 | $ComboBox1.Items.add("Software Update") 44 | $ComboBox1.Items.add("Deployment Package") 45 | $ComboBox1.Items.add("Software Update Group") 46 | $Form1.ShowDialog() 47 | } 48 | 49 | #Function to get the software update group membership of updates 50 | function Get-SoftwareUpdateGroupMembership { 51 | param ( 52 | [array]$Updates 53 | ) 54 | foreach ($Update in $Updates) { 55 | $UpdateCIID = $Update.CI_ID 56 | $UpdateGroupNames = (Get-WmiObject -Namespace root/SMS/site_$($SiteCode) -ComputerName $SiteServer -Query "SELECT DISTINCT ALI.* from SMS_AuthorizationList ALI ` 57 | JOIN SMS_CIRelation CIR on ALI.CI_ID = CIR.fromCIID WHERE CIR.ToCIID='$UpdateCIID'").LocalizedDisplayName 58 | if ($UpdateGroupNames -ne $null) { 59 | foreach ($Name in $UpdateGroupNames) { 60 | $UpdateGroupName = $Name 61 | $DataGridView1.Rows.Add($UpdateGroupName,$Update.ArticleId,$Update.LocalizedDisplayName) | Out-Null 62 | } 63 | } 64 | else { 65 | $UpdateGroupName = "" 66 | $DataGridView1.Rows.Add($UpdateGroupName,$Update.ArticleId,$Update.LocalizedDisplayName) | Out-Null 67 | } 68 | } 69 | } 70 | 71 | #Function to get the deployment package membership of updates 72 | function Get-DeploymentPackageMembership { 73 | param ( 74 | [array]$Updates 75 | ) 76 | foreach ($Update in $Updates) { 77 | $UpdateCIID = $Update.CI_ID 78 | $UpdatePackageNames = (Get-WmiObject -Namespace root/SMS/site_$($SiteCode) -ComputerName $SiteServer -Query "SELECT DISTINCT sup.* FROM SMS_SoftwareUpdatesPackage AS sup ` 79 | JOIN SMS_PackageToContent AS pc ON sup.PackageID=pc.PackageID JOIN SMS_CIToContent AS cc ON pc.ContentID = cc.ContentID WHERE CC.CI_ID='$UpdateCIID'").Name 80 | if ($UpdatePackageNames -ne $null) { 81 | foreach ($UpdatePackageName in $UpdatePackageNames) { 82 | $DataGridView2.Rows.Add($UpdatePackageName,$Update.ArticleId,$Update.LocalizedDisplayName) | Out-Null 83 | } 84 | } 85 | else { 86 | $UpdatePackageName = "" 87 | $DataGridView2.Rows.Add($UpdatePackageName,$Update.ArticleId,$Update.LocalizedDisplayName) | Out-Null 88 | } 89 | } 90 | } 91 | 92 | #Function to get the members of a software update group 93 | function Get-SoftwareUpdateGroupMembers { 94 | param ( 95 | [string]$Group 96 | ) 97 | $UpdateGroupCIID = (Get-WmiObject -ComputerName $SiteServer -Namespace root/SMS/site_$($SiteCode) -Class SMS_AuthorizationList -Filter "LocalizedDisplayName='$Group'").CI_ID 98 | $Updates = Get-WmiObject -Namespace root/SMS/site_$($SiteCode) -ComputerName $SiteServer -Query "SELECT upd.* FROM SMS_SoftwareUpdate upd, SMS_CIRelation cr WHERE cr.FromCIID='$UpdateGroupCIID' AND cr.RelationType=1 AND upd.CI_ID=cr.ToCIID" 99 | if ($Updates -ne $null) { 100 | foreach ($Update in $Updates) { 101 | $DataGridView1.Rows.Add($Group,$Update.ArticleId,$Update.LocalizedDisplayName) | Out-Null 102 | } 103 | } 104 | else { 105 | } 106 | return $Updates 107 | } 108 | 109 | #Function to get the members of a deployment package 110 | function Get-DeploymentPackageMembers { 111 | param ( 112 | [string]$Package 113 | ) 114 | $UpdatePackageID = (Get-WmiObject -ComputerName $SiteServer -Namespace root/SMS/site_$($SiteCode) -Class SMS_SoftwareUpdatesPackage -Filter "Name='$Package'").PackageID 115 | $Updates = Get-WmiObject -Namespace root/SMS/site_$($SiteCode) -ComputerName $SiteServer -Query "SELECT DISTINCT su.* FROM SMS_SoftwareUpdate AS su JOIN SMS_CIToContent AS cc ` 116 | ON SU.CI_ID = CC.CI_ID JOIN SMS_PackageToContent AS pc ON pc.ContentID=cc.ContentID WHERE pc.PackageID='$UpdatePackageID' AND su.IsContentProvisioned=1" 117 | if ($Updates -ne $null) { 118 | foreach ($Update in $Updates) { 119 | $DataGridView2.Rows.Add($Package,$Update.ArticleId,$Update.LocalizedDisplayName) | Out-Null 120 | } 121 | } 122 | else { 123 | } 124 | return $Updates 125 | } 126 | 127 | #Button1 OnClick event 128 | $Button1_OnClick= { 129 | $Form1.Close() 130 | } 131 | 132 | #Button2 OnClick event 133 | $Button2_OnClick= { 134 | Try { 135 | if ($DataGridView1 -ne $null) { 136 | $DataGridView1.Rows.Clear() 137 | $DataGridView2.Rows.Clear() 138 | $Form1.Refresh() 139 | } 140 | 141 | $ErrorProvider1.SetError($TextBox1,"") 142 | $ErrorProvider1.SetError($ComboBox1,"") 143 | 144 | if($TextBox1.Text.Length -eq 0 -or $ComboBox1.SelectedItem -eq $null) { 145 | if($TextBox1.Text.Length -eq 0) { 146 | $ErrorProvider1.SetError($TextBox1, "Please provide a valid name") 147 | } 148 | if ($ComboBox1.SelectedItem -eq $null) { 149 | $ErrorProvider1.SetError($ComboBox1, "Please select a valid type") 150 | } 151 | } 152 | else { 153 | $Name = $TextBox1.Text 154 | $Type = $ComboBox1.SelectedItem 155 | 156 | if ($Type -eq "Software Update") { 157 | $GroupBox1.Text = "Software Update Group" 158 | $GroupBox2.Text = "Deployment Package" 159 | $TextBox1.Enabled = $false 160 | $ComboBox1.Enabled = $false 161 | 162 | $Updates = Get-WmiObject -ComputerName $SiteServer -Namespace root/SMS/site_$($SiteCode) -Class SMS_SoftwareUpdate -Filter "ArticleID='$Name'" 163 | if ($Updates -ne $null) { 164 | Get-SoftwareUpdateGroupMembership $Updates 165 | Get-DeploymentPackageMembership $Updates 166 | } 167 | else { 168 | $ErrorProvider1.SetError($TextBox1, "Please provide a valid article id of a software update") 169 | } 170 | $ComboBox1.Enabled = $true 171 | $TextBox1.Enabled = $true 172 | } 173 | elseif ($Type -eq "Software Update Group") { 174 | $GroupBox1.Text = "Software Update Group: $Name" 175 | $GroupBox2.Text = "Deployment Package" 176 | $TextBox1.Enabled = $false 177 | $ComboBox1.Enabled = $false 178 | 179 | $Updates = Get-SoftwareUpdateGroupMembers $Name 180 | if ($Updates -ne $null) { 181 | Get-DeploymentPackageMembership $Updates 182 | } 183 | else { 184 | $ErrorProvider1.SetError($TextBox1, "Please provide a valid name of a software update group") 185 | } 186 | $ComboBox1.Enabled = $true 187 | $TextBox1.Enabled = $true 188 | } 189 | elseif ($Type -eq "Deployment Package") { 190 | $GroupBox1.Text = "Software Update Group" 191 | $GroupBox2.Text = "Deployment Package: $Name" 192 | $TextBox1.Enabled = $false 193 | $ComboBox1.Enabled = $false 194 | 195 | $Updates = Get-DeploymentPackageMembers $Name 196 | if ($Updates -ne $null) { 197 | Get-SoftwareUpdateGroupMembership $Updates 198 | } 199 | else { 200 | $ErrorProvider1.SetError($TextBox1, "Please provide a valid name of a deployment package") 201 | } 202 | $ComboBox1.Enabled = $true 203 | $TextBox1.Enabled = $true 204 | } 205 | } 206 | } 207 | Catch { 208 | [Windows.Forms.MessageBox]::Show(“Please provide a valid combination of a name and type”, “Software Update Information”, [Windows.Forms.MessageBoxButtons]::OK, [Windows.Forms.MessageBoxIcon]::Error) 209 | } 210 | } 211 | 212 | #LinkLabel1 event 213 | $LinkLabel1_OpenLink= { 214 | [System.Diagnostics.Process]::start($LinkLabel1.text) 215 | } 216 | 217 | #LinkLabel2 event 218 | $LinkLabel2_OpenLink= { 219 | [System.Diagnostics.Process]::start("http://twitter.com/pvanderwoude") 220 | } 221 | 222 | #Load Assemblies 223 | [Reflection.Assembly]::LoadWithPartialName("System.Drawing") | Out-Null 224 | [Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") | Out-Null 225 | 226 | #Create ErrorProvider 227 | $ErrorProvider1 = New-Object System.Windows.Forms.ErrorProvider 228 | $ErrorProvider1.BlinkStyle = "NeverBlink" 229 | 230 | #Create Form1 231 | $Form1 = New-Object System.Windows.Forms.Form 232 | $Form1.Size = New-Object System.Drawing.Size(700,590) 233 | $Form1.MinimumSize = New-Object System.Drawing.Size(700,590) 234 | $Form1.MaximumSize = New-Object System.Drawing.Size(700,590) 235 | $Form1.SizeGripStyle = "Hide" 236 | $Form1.Text = "Software Update Information" 237 | $Form1.ControlBox = $true 238 | $Form1.TopMost = $true 239 | 240 | #Create Button1 241 | $Button1 = New-Object System.Windows.Forms.Button 242 | $Button1.Location = New-Object System.Drawing.Size(510,490) 243 | $Button1.Size = New-Object System.Drawing.Size(150,25) 244 | $Button1.Text = "Close" 245 | $Button1.add_Click($Button1_OnClick) 246 | 247 | #Create Button2 248 | $Button2 = New-Object System.Windows.Forms.Button 249 | $Button2.Location = New-Object System.Drawing.Size(510,30) 250 | $Button2.Size = New-Object System.Drawing.Size(150,25) 251 | $Button2.Text = "Execute" 252 | $Button2.add_Click($Button2_OnClick) 253 | 254 | #Create ComboBox1 255 | $ComboBox1 = New-Object System.Windows.Forms.ComboBox 256 | $ComboBox1.Location = New-Object System.Drawing.Size(255,30) 257 | $ComboBox1.Size = New-Object System.Drawing.Size(150,25) 258 | $comboBox1.Text = "" 369 | $arrDeviceActions = @("Sync Request","Sync Request State") 370 | 371 | If ($DataGridView.CurrentRow -ne $Null) { 372 | $ButtonRetire.Enabled = $True 373 | $ButtonExecute.Enabled = $True 374 | $ComboBoxAction.Enabled = $True 375 | 376 | #Get the platform to add a correct device actions 377 | $ResourceOS = $DataGridView.CurrentRow.Cells[3].Value 378 | If ($ResourceOS -notlike "*Windows 10*") { 379 | $arrDeviceActions = $arrDeviceActions += "Remote Lock","Remote Lock State","Reset Passcode","Reset Passcode State" 380 | } 381 | If (($ResourceOS -like "*Windows 10*" -or $ResourceOS -like "*iOS*" -or $ResourceOS -like "*Android*") -and $AllowWipe -eq $True) { 382 | $ButtonWipe.Enabled = $True 383 | } 384 | } 385 | 386 | ForEach ($strDeviceAction in $arrDeviceActions) { 387 | $ComboBoxAction.Items.Add($strDeviceAction) 388 | } 389 | } 390 | 391 | #LinkLabelBlog event to open a browser session to my blog 392 | $LinkLabelBlog_OpenLink= { 393 | [System.Diagnostics.Process]::start($LinkLabelBlog.text) 394 | } 395 | 396 | #LinkLabelTwitter OpenLink event to open a browser session to my twitter page 397 | $LinkLabelTwitter_OpenLink= { 398 | [System.Diagnostics.Process]::start("http://twitter.com/pvanderwoude") 399 | } 400 | 401 | #Load Assemblies 402 | [Reflection.Assembly]::LoadWithPartialName("System.Drawing") | Out-Null 403 | [Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") | Out-Null 404 | 405 | #Create ToolTip 406 | $ToolTip = New-Object System.Windows.Forms.ToolTip 407 | 408 | #Create ErrorProvider 409 | $ErrorProvider = New-Object System.Windows.Forms.ErrorProvider 410 | $ErrorProvider.BlinkStyle = "NeverBlink" 411 | 412 | #Create Form 413 | $Form = New-Object System.Windows.Forms.Form 414 | $Form.Size = New-Object System.Drawing.Size(780,400) 415 | $Form.MinimumSize = New-Object System.Drawing.Size(780,400) 416 | $Form.MaximumSize = New-Object System.Drawing.Size(780,400) 417 | $Form.SizeGripStyle = "Hide" 418 | $Form.StartPosition = "CenterScreen" 419 | $Form.Text = "Remote Mobile Device Manager" 420 | $Form.ControlBox = $False 421 | $Form.TopMost = $True 422 | $Form.Add_Shown({$Form.Activate(); $TextBoxUser.focus()}) 423 | 424 | #Create ButtonClose 425 | $ButtonClose = New-Object System.Windows.Forms.Button 426 | $ButtonClose.Location = New-Object System.Drawing.Size(590,295) 427 | $ButtonClose.Size = New-Object System.Drawing.Size(150,23) 428 | $ButtonClose.Text = "Close" 429 | $ButtonClose.add_Click({$Form.Close()}) 430 | 431 | #Create ButtonExecute 432 | $ButtonExecute = New-Object System.Windows.Forms.Button 433 | $ButtonExecute.Location = New-Object System.Drawing.Size(590,25) 434 | $ButtonExecute.Size = New-Object System.Drawing.Size(150,23) 435 | $ButtonExecute.Text = "Execute Remote Action" 436 | $ButtonExecute.Enabled = $False 437 | $ButtonExecute.add_Click({Execute-RemoteAction $ComboBoxAction.SelectedItem}) 438 | 439 | #Create ButtonGet 440 | $ButtonGet = New-Object System.Windows.Forms.Button 441 | $ButtonGet.Location = New-Object System.Drawing.Size(170,25) 442 | $ButtonGet.Size = New-Object System.Drawing.Size(150,22) 443 | $ButtonGet.Text = "Get Mobile Devices" 444 | $ButtonGet.add_Click({Get-MobileDevices $TextBoxUser.Text}) 445 | 446 | #Create ButtonRetire 447 | $ButtonRetire = New-Object System.Windows.Forms.Button 448 | $ButtonRetire.Location = New-Object System.Drawing.Size(20,295) 449 | $ButtonRetire.Size = New-Object System.Drawing.Size(150,23) 450 | $ButtonRetire.Text = "Retire" 451 | $ButtonRetire.Enabled = $False 452 | $ButtonRetire.add_Click({Retire-MobileDevice $DataGridView.CurrentRow.Cells[6].Value $DataGridView.CurrentRow.Cells[0].Value}) 453 | 454 | #Create ButtonWipe 455 | $ButtonWipe = New-Object System.Windows.Forms.Button 456 | $ButtonWipe.Location = New-Object System.Drawing.Size(170,295) 457 | $ButtonWipe.Size = New-Object System.Drawing.Size(150,23) 458 | $ButtonWipe.Text = "Wipe" 459 | $ButtonWipe.Enabled = $False 460 | $ButtonWipe.add_Click({Wipe-MobileDevice $DataGridView.CurrentRow.Cells[6].Value $DataGridView.CurrentRow.Cells[0].Value}) 461 | 462 | #Create ComboBoxAction 463 | $ComboBoxAction = New-Object System.Windows.Forms.ComboBox 464 | $ComboBoxAction.Location = New-Object System.Drawing.Size(440,26) 465 | $ComboBoxAction.Size = New-Object System.Drawing.Size(150,25) 466 | $ComboBoxAction.Text = "