VMware Cloud Community
Mikael_8313
Contributor
Contributor

Script Load Custom Properties and make a variable for argument powershell

Hi everybody,

I want to make a new workflow for remove entry DNS by powershell script. First, I write the script task to see and load some variables that I need, after that I want make a output variable (argument) to build a perfect syntax for the workflow "External script Powershell" in line Argument.

When I launch the script, I have a big issue with many error. Sorry at the moment I don't have the output error. But I want to be sur if my code is good and I don't have errors in my script.

var vmProperties = machine.get("properties");

var machine = payload.get("machine") ;

var computerName = machine.get("name");

var partenaire = payload.machine.properties.get("XX.Partenaire_ID");

var os = payload.machine.properties.get("XX.OS_ID");

var trigramme = payload.machine.properties.get("XX.TrigrammeApplication");

var fonction = payload.machine.properties.get("XX.Fonction");

var env = payload.machine.properties.get("XX.Environnement");

var ip = payload.machine.properties.get("VirtualMachine.Network0.Address");

System.log("NIVEAU 1");

var key;

for each (key in payload.keys)

{

              System.log(key +" = " +payload.get(key));

}

System.log("NIVEAU 2");

var key2;

for each (key2 in payload.machine.keys)       

{

                System.log(key2 +" = " +payload.machine.get(key2));

}

System.log("NIVEAU 3");

var key3;

for each (key3 in payload.machine.properties.keys)       

{

      System.log(key3 +" = " +payload.machine.properties.get(key3));

}

if (partenaire == "XX") {

                 var zone = "XX.XX";

}

        else if (partenaire == "XX") {

                 var zone = "XX.XX";

}         else (partenaire == "XX")

                {

                 var zone = "XX.XX";

                }

System.log("Environnement: "+vmProperties.get("Environnement"));

System.log("Machine: "+vmProperties.get("Machine"));

System.log("Partenaire: "+vmProperties.get("Machine"));

argument = "XX" + zone + ip + computerName ;

System.log = argument

Thank you guys to help me Smiley Happy

Best Regard

Mikael

Tags (1)
Reply
0 Kudos
0 Replies