With GUI
- 2 Arguments with the script

- In the ‘Task ID’ field, add our Task ID

- In the computer section, add the workstations to be added to the task
Powershell Script
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | [void][System.Reflection.Assembly] ::LoadWithPartialName( 'presentationframework' ) [xml] $XAML = @' <Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" Title="Add To Task" Height="450" Width="250" WindowStartupLocation="CenterScreen"> <Window.Resources> <Style TargetType="Label"> <Setter Property="Margin" Value="10,0,10,0"/> <Setter Property="FontSize" Value="12"/> </Style> <Style TargetType="TextBox"> <Setter Property="Margin" Value="10,0,10,0"/> <Setter Property="FontSize" Value="12"/> </Style> <Style TargetType="Button"> <Setter Property="Margin" Value="10,0,10,0"/> <Setter Property="FontSize" Value="14"/> <Setter Property="Height" Value="30"/> <Setter Property="Background" Value="#FF123456"/> <Setter Property="Foreground" Value="White"/> </Style> </Window.Resources> <Grid> <Label Content="Task ID" HorizontalAlignment="Left" VerticalAlignment="Top"/> <TextBox Name="TaskID" HorizontalAlignment="Stretch" VerticalAlignment="Top" Height="23" Width="Auto" Margin="10,30,10,0"/> <Label Content="Computer" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="0,80,0,0"/> <TextBox Name="PC" AcceptsReturn="True" HorizontalAlignment="Stretch" VerticalAlignment="Top" Height="216" Width="Auto" Margin="10,110,10,0"/> <Button Content="Add to task" Name="Add" HorizontalAlignment="Stretch" VerticalAlignment="Bottom" Width="Auto" Margin="10,0,10,10"/> </Grid> </Window> '@ #Read XAML $reader =( New-Object System.Xml.XmlNodeReader $xaml ) try{ $Form = [Windows.Markup.XamlReader] ::Load( $reader )} catch{ Write-Host "Unable to load Windows.Markup.XamlReader. Some possible causes for this problem include: .NET Framework is missing PowerShell must be launched with PowerShell -sta, invalid XAML code was encountered." ; exit} #=========================================================================== # Store Form Objects In PowerShell #=========================================================================== $xaml .SelectNodes( "//*[@Name]" ) | %{ Set-Variable -Name ( $_ .Name) -Value $Form .FindName( $_ .Name)} $ofs = "`r`n" $Add .add_Click({ If ( $TaskID .Text -ne " ") { $Task = $TaskID.Text $mycreds = Get-Credential -Credential " leblogosd\david " $ldWS = New-WebServiceProxy -uri https://monserveur.domain.lan/MBSDKService/MsgSDK.asmx -Credential $mycreds Foreach ($ComputerName in $PC.Text) { $ComputerName = $ComputerName.Trim() $Temp = $ComputerName.split($ofs) Foreach ($tt in $Temp) { $tt = $tt.Trim() If ($tt -ne "") { #write-host " >>> $ldWS .AddDeviceToScheduledTask( $Task , $tt )<<< " $ldWS.AddDeviceToScheduledTask($Task, $tt) } } } write-host " End " } else { write-host " Error task ID" } }) # Display UI object $Form .ShowDialog() | out-null |
Don’t forget to change the name of your IVANTI EPM server in the script (line 36).
Console-mode script
2 arguments to the script:
- The TXT file (may be a future modification for CSV import).
- The Task ID number.

Note: Change the URL with the name of your LANDESK server.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | Param ( [ parameter ( Mandatory = $true )] [String] $FichierCSV , [ parameter ( Mandatory = $true )] [String] $TaskID ) $mycreds = Get-Credential -Credential "mondomaine\dwuibail_adm" $ldWS = New-WebServiceProxy -uri http://coreserveurlandesk.domaine.lan/MBSDKService/MsgSDK.asmx ? WSDL -Credential $mycreds # $ldWS.ListMachines("").Devices | Format-Table * $CSV = Get-Content $FichierCSV foreach ( $line in $CSV ) { $ldWS .AddDeviceToScheduledTask( $TaskID , $line ) } |
http://localhost/MBSDKService/MsgSDK.asmx?WSDL/GetMachineData => Allows you to see all available functions on your EPM core server
1 Comment
steven · 28 February 2025 at 5h36
ScheduleDistribution, did you manage to get this working?
tried the target using device name, id do not work