This C# program should run on a DTM server. It's used by the whql_client_install test to delete the client machine from the server's data store (if listed there) prior to client installation. This seems to be necessary to prevent trouble during testing (like failure to contact the client machine). Note: the binary is copied to the server at run time, so it doesn't need to be packaged in winutils.iso. Signed-off-by: Michael Goldish <mgoldish@xxxxxxxxxx> --- client/tests/kvm/deps/whql_delete_machine_15.cs | 82 ++++++++++++++++++++++ client/tests/kvm/deps/whql_delete_machine_15.exe | Bin 0 -> 5632 bytes 2 files changed, 82 insertions(+), 0 deletions(-) create mode 100644 client/tests/kvm/deps/whql_delete_machine_15.cs create mode 100644 client/tests/kvm/deps/whql_delete_machine_15.exe diff --git a/client/tests/kvm/deps/whql_delete_machine_15.cs b/client/tests/kvm/deps/whql_delete_machine_15.cs new file mode 100644 index 0000000..1d78a6d --- /dev/null +++ b/client/tests/kvm/deps/whql_delete_machine_15.cs @@ -0,0 +1,82 @@ +// DTM machine deletion tool +// Author: Michael Goldish <mgoldish@xxxxxxxxxx> +// Based on sample code by Microsoft. + +using System; +using System.Collections.Generic; +using System.Text.RegularExpressions; +using Microsoft.DistributedAutomation.DeviceSelection; +using Microsoft.DistributedAutomation.SqlDataStore; + +namespace automate0 +{ + class AutoJob + { + static int Main(string[] args) + { + if (args.Length != 2) + { + Console.WriteLine("Error: incorrect number of command line arguments"); + Console.WriteLine("Usage: {0} serverName clientName", + System.Environment.GetCommandLineArgs()[0]); + return 1; + } + string serverName = args[0]; + string clientName = args[1]; + + try + { + // Initialize DeviceScript and connect to data store + Console.WriteLine("Initializing DeviceScript object"); + DeviceScript script = new DeviceScript(); + Console.WriteLine("Connecting to data store"); + script.ConnectToNamedDataStore(serverName); + + // Find the client machine + IResourcePool rootPool = script.GetResourcePoolByName("$"); + Console.WriteLine("Looking for client machine '{0}'", clientName); + IResource machine = rootPool.GetResourceByName(clientName); + if (machine == null) + { + Console.WriteLine("Client machine not found"); + return 0; + } + Console.WriteLine("Client machine '{0}' found ({1}, {2})", + clientName, machine.OperatingSystem, machine.ProcessorArchitecture); + + // Change the client machine's status to 'unsafe' + Console.WriteLine("Changing the client machine's status to 'Unsafe'"); + try + { + machine.ChangeResourceStatus("Unsafe"); + } + catch (Exception e) + { + Console.WriteLine("Warning: " + e.Message); + } + while (machine.Status != "Unsafe") + { + try + { + machine = rootPool.GetResourceByName(clientName); + } + catch (Exception e) + { + Console.WriteLine("Warning: " + e.Message); + } + System.Threading.Thread.Sleep(1000); + } + + // Delete the client machine from datastore + Console.WriteLine("Deleting client machine from data store"); + script.DeleteResource(machine.Id); + return 0; + } + catch (Exception e) + { + Console.WriteLine("Error: " + e.Message); + return 1; + } + } + } +} diff --git a/client/tests/kvm/deps/whql_delete_machine_15.exe b/client/tests/kvm/deps/whql_delete_machine_15.exe new file mode 100644 index 0000000000000000000000000000000000000000..7f571345dd04b1871c5156556791d97ca2564419 GIT binary patch literal 5632 zcmeHLO>i7X6@If?N$a(>u_XV+mhI8nE=x|dT04dqW7)gX%Fa5HCA5;91X1?vY-=^n z?98TTR!A`>IwVwaq3oi#_yUKxfEy61NI?My2%KD%V=g$Zf<u6U9PojH;PAbk*&oS{ z%Umh<y1QS$|M$A*b<2~lT&Ff7ilTq|Dbc%_xn<P&=wS`y#QvWr=%<@*_rI%6-0q)U zvOK*i-Lf<)x@kC$>+40K%bKHGj-Hz;=oPmlQe9o~gQ4o_aiR&WjZXjm>_pw#U5aR% zwHVPBU@&pJe*}Y$o<Zk9#}o<t2BiGwnby#O=hjA<w}`f?f6X~u1}yXg=q)guA^L!m zu(4eZ-1z4pQQt<|qt<%Eb;T9K`h^z$lrL6%tfQMTfTm&%{l-c)o#=8(deX#7`IZ6D zfu2BbX&HE*lEQYu$SI@C=&WlSdP~a?jkYWmc$f2v#=b?Uoj&O&`lORc!y28f{ZDOA zI!Z4>5dXR(-?Db4_DX=&0i-rA1w-wCcHA6*=J?JdksUYVk)1a;%kS5jJQ$B}k$<kQ zV;wGzKs+Y*XjFAK0qm0d0d^`4n>yV%P`%Oa=unR|fLE4w^v3@1JNPZ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mxgAIdaxtkA+u!n|`*P<0_tM$h)YrHFZaBjH($A$Hp;n4zlo=Z*G1O*ziopxmcf# zjdBpBkALy&Q)gBxw!SQ+hj-XW@@OiZ)P-ZZ{EQh%&dr`3I+4^pABD}ZT}O;0SA~~6 zbGj>j%J4i<DcY+#6gb{UvL>CAp1C9{hBs8HzyF3zw{p_(Dyik8NgeM+YZ0&J`BrOC zrRxo4`4Z|V-bU*@!XIGp%E4oABssa7tyXOduP%N^8r5oYIMCqBn&;=8MfWlNIhIs% zu<Z%6hF9)txCTbzi3UGKX<Ay#cwCo-_n2Crt83NKntD)b%^G_=A(n-$+dPgW4KMF3 zyRQnF)N5AO<QM5ka?!9o5eB7{3_rx1y6eO1d_OhZNCFs64cB)F3*PM~?XfeUhyQ2v O#mAO-!uWrbf&T)7*;pL_ literal 0 HcmV?d00001 -- 1.5.5.6 -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html