This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Test-Function { | |
[CmdletBinding()] | |
param( | |
[parameter(Mandatory, Position = 0, ValueFromPipeline)] | |
[string[]] | |
$Values | |
) | |
process { | |
$Values.ForEach({ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Removes all OneDrive attributes from files | |
Get-ChildItem * -Recurse -Depth 999 | % { | |
$flagsToRemove = 0x00040000 -bor 0x00080000 -bor 0x00100000 -bor 0x00040000 -bor 0x00400000 | |
$flags = [System.IO.File]::GetAttributes($_.FullName) | |
$fixedFlags = $flags -band (-bnot $flagsToRemove) | |
[System.IO.File]::SetAttributes($_.FullName, $fixedFlags) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This script adds the permissions required for Azure Automation Jobs running on a Hybrid Worker under custom credentials | |
# Ref: https://learn.microsoft.com/en-us/azure/automation/migrate-existing-agent-based-hybrid-worker-to-extension-based-workers?tabs=bicep-template%2Cwin-hrw#permissions-for-hybrid-worker-credentials | |
$identity = "..." # Set the identity used in the custom credential here | |
# Do not change anything after this line | |
$folder = "C:\Packages\Plugins\Microsoft.Azure.Automation.HybridWorker.HybridWorkerForWindows" | |
$fileSystemRights = [System.Security.AccessControl.FileSystemRights]::ReadAndExecute | |
$inheritanceFlag = [System.Security.AccessControl.InheritanceFlags]::ContainerInherit -bor [System.Security.AccessControl.InheritanceFlags]::ObjectInherit |