![]() fileName C:DATACustomers.json Invoke-SqlCmd -Query SELECT FROM SampleText. #Powershell json query installTo work with AAD groups I prefer to use the AzureAD module, so install that before continuing. Selection from SQL Server 2014 with PowerShell v5 Cookbook Book. To do that, we need the objectId of the AAD group we want to assign it to. Add an Assignmentīefore the script will execute anywhere it needs to be assigned to a group. We can call Get on the script again and check the lastModifiedDateTime entry to verify that the script was updated, or check in the portal. ![]() $Response = Invoke-MSGraphRequest -HttpMethod PATCH -Url $URI -Content $Json "runAs32Bit": = "deviceManagement/deviceManagementScripts/$($IntuneScript.id)" But first we need to get the Id of the script we want to update, using our previously created function:ĭescription = "Backup Bitlocker Recovery key for OS volume to AAD (Updated )" #Powershell json query updateTo update an existing script, we follow a similar process to creating a new script, we create some JSON that contains the updated parameters then call the Patch method to update it. Note When the REST endpoint returns multiple objects, the objects are received as an array. C:DATACustomers.json Invoke-SqlCmd -Query SELECT FROM SampleText -ServerInstance instanceName. For JavaScript Object Notation (JSON) or XML, PowerShell converts, or deserializes, the content into PSCustomObject objects. SQL Server 2014 with PowerShell v5 Cookbook. For an RSS or ATOM feed, PowerShell returns the Item or Entry XML nodes. We can now see our script in the portal: Update a Script PowerShell formats the response based to the data type. ![]() $Response = Invoke-MSGraphRequest -HttpMethod POST -Url $URI -Content $Json "runAs32Bit": = "deviceManagement/deviceManagementScripts" "enforceSignatureCheck": $($Params.EnforceSignatureCheck), "runAsAccount": "$($Params.RunAsAccount)", (az vm list ConvertFrom-Json) Select-Object name. "scriptContent": "$($Params.ScriptContent)", Pipe the result from az cli to PowerShell's ConvertFrom-Json, it gets converted to an array of objects, and then you pipe it to the Select-Object cmdlet to display the name property. ScriptContent = ::ToBase64String(::UTF8.GetBytes((Get-Content -Path "$ScriptPath\$ScriptName" -Raw -Encoding UTF8)))ĭisplayName = "Escrow Bitlocker Recovery Keys"ĭescription = "Backup Bitlocker Recovery key for OS volume to AAD" $ScriptName = "Escrow-BitlockerRecoveryKeys.ps1" ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |