Hi.
I am looking to move some scripts over to ARS to run as a scheduled task. If we run this manually we are asked to select a location value which then maps to the correct CSV file in a specified location.
Whats the best way of passing a value to the script at run time? I assume it would be four scheduled tasks based on how many locations we need to use?
Thanks in advance
function Run-Active-Roles ($Request)
{
Import-OneDrive_URL
}
function Import-OneDrive_URL {
param (
$AzureLocation = (Read-Host -Prompt 'Enter Azure location. GBR or CHE or APC or NAM')
)
#Import CSV
$CSVImport = "C:\ARS-Scripts\_OneDrive_Export\$AzureLocation-OneDrive-for-Business-Users.csv"
Connect-QADService -Service "ARS.FQDN_HERE" -Proxy
Import-Csv $CSVImport | ForEach-Object {
$CurrentUser = [string]$_.UserName
$OneDriveSiteUrlContents = [string]$_.OneDriveSiteUrl
$TargetUser = Get-QADUser -LdapFilter "(userprincipalname=$CurrentUser)" | select -expandproperty DN
Set-QADUser -Identity $TargetUser -ObjectAttributes @{"ARS_VA_NAME_HERE"=$OneDriveSiteUrlContents}
}
}

