Execution of Script PowerShell host - spaces in settings
Hi guys,.
How to pass a parameter from vRO to a remote host from PowerShell with a space (for example the subject and the body in the script below)? If I quote the parameter in the form of vRO, it works fine, but I want to do it programmatically to make sure that my users don't need to use quotes, through vRA.
Script is similar to:
var output;
var session;
var sender = arguments + "" + recipient + "" + subject + "" + body + "" + smtpServer;
try {}
session = host.openSession ();
script var = "&" ' + externalScript + ' "' + arguments;"
Output = System.getModule("com.vmware.library.powershell").invokeScript (host, script, session.getSessionId ());
}
{Finally
If {(session)
host.closeSession (session.getSessionId ());
}
}
Thank you
Dan
Hi Dan,.
Instead of using PowerShell, vRO can send emails too.
To answer your question, you could include quotes like this:
"var arguments = sender +" "+ recipient +"\"" + subject + '\' \ "' + body +"------""+ smtpServer;
Michael
Tags: VMware
Similar Questions
-
Security settings do not allow execution of script code in the report.xsl stylesheet
Hello world
I can't open a file of XML in Excel 2007 results - even if I added the stylesheet for trusted locations and deleted all the protections.
Here's what happens:
1. open the XML results file how I am propmpted for select the report.xsl stylesheet TestStand
2. then gives error: Scripts in this XML document and/or references to other documents are disabled.
3. by clicking OK gives more specific information - namely the security settings don't allow execution of code within this stylesheet script:
But I did the following:
-The path to the sheethas style was added to the "trusted locations".
-ActiveX settings are completely enabled for all controls without restrictions
-Macros settings are enabled for all macros
-Is trust access to the VBA project object model
-All data connections are allowed
How can I activate the execution of script code in the style sheet for the file XML can load?
Thank you
Ronnie
Ronnie-
Directly from the Article in the Microsoft Knowledge base, please note that do the following changes "may make your computer or your network more vulnerable to attack by malicious software such as viruses." It's always a good idea to make a backup of your registry before editing. This can be done by clicking on file' export.
In any case, as the article explains, open the registry and navigate to HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Security. The security file must contain a registry key called XSLSecurityLevel. Mine did not have this registry key and I had to create it (see screenshot below). Double-click the XSLSecurityLevel registry key, type 1 in the data value, and then click OK.
You should now be able to view the XML from Excel 2007 report. To reset this setting, simply double-click the registry XSLSecurityLevel key, enter 0 in the given value, and then click OK.
I hope this helps!
-
Problem - add in plugin PowerShell PowerShell host
Hello world.
I want to run PS scripts locally on a host of the vCO.
I have installed the components on it:
1 WS 2008 R2
2 vCO V5.1.0 build 2725
3 PowerShell plugin V1.0.1
4 WinRM V2.0
5 PowerShell V2.0
I configured WinRM by this command as an administrator:
WinRM quickconfig
WinRM set winrm/config/service/authentication @{basic = "true"}
WinRM set winrm/config/service @{AllowUnencrypted = 'true'}
WinRM set winrm/config/service/authentication @{basic = "true"}
WinRM set winrm/config/client @{AllowUnencrypted = 'true'}
WinRM set winrm/config/client @{TrustedHosts = "vco_host"}
WinRM get winrm/config
Config
MaxEnvelopeSizekb = 150
MaxTimeoutms 60000 =
MaxBatchItems 32000 =
MaxProviderRequests 4294967295 =
Customer
NetworkDelayms = 5000
URLPrefix = wsman
AllowUnencrypted = true
AUTH
Base = true
Digest = true
Kerberos = true
Negotiate = true
Certificate = true
CredSSP = false
DefaultPorts
HTTP = 5985
HTTPS = 5986
TrustedHosts = 127.0.0.1, vco_host
Service
RootSDDL = O:NSG:BAD:P(A;;) GA; S:P(ALE;FA;GA;;;) (BA) WD) (AU; SA; GWGX; WD)
MaxConcurrentOperations = 4294967295
MaxConcurrentOperationsPerUser = 15
EnumerationTimeoutms = 60000
MaxConnections = 25
MaxPacketRetrievalTimeSeconds = 120
AllowUnencrypted = true
AUTH
Base = true
Kerberos = true
Negotiate = true
Certificate = false
CredSSP = false
CbtHardeningLevel = relaxed
DefaultPorts
HTTP = 5985
HTTPS = 5986
IPv4Filter = *.
IPv6Filter = *.
EnableCompatibilityHttpListener = false
EnableCompatibilityHttpsListener = false
CertificateThumbprint
WinRS
AllowRemoteShellAccess = true
IdleTimeout = 180000
MaxConcurrentUsers = 5
MaxShellRunTime = 2147483647
MaxProcessesPerShell = 15
MaxMemoryPerShellMB = 150
MaxShellsPerUser = 5
But when I want to add PowerShell host in PowerShell plugin I didn't do good. Nothing in the newspaper.
I used HTTP, 5985, shared session and user session basis.
Can someone help me please?
Thank you.
micy01
Your log says: "Unable to load library 'vix'" - done-a you try to install the VERY OLD, obsolete plugin VIX on this host? If so, which causes all sorts of problems.
1 it requires a basis of vCO Windows Server.
2 If the initial configuration workflow is not running, it screws the other workflows
3 If the library files are not unpacked in the correct on the vCO Windows Server folder, random questions appear throughout many parts of the vCO.
It seems that you have:
2013-10-23 15:40:27.219 + 0200 WARN [WorkflowHandler] error in the execution of the workflow 'add a PowerShell host '.
java.lang.UnsatisfiedLinkError: cannot load library 'vix': Uvedeny modul nebyl nalezen.
2013-10-23 16:46:49.511 + 0200 [performance] execution of workflow INFO ' copy to get virtual computers by name.
2013-10-23 16:46:49.713 + 0200 WARN [WorkflowHandler] error in the execution of the workflow "copy to get the virtual computers by name.
java.lang.NoClassDefFoundError: has not been initialized class com.vmware.vmo.plugin.vix.VixServer
Remove the plugin VIX on your server and restart the Server Service of vCO. Your problems should go away
-
Unable to load psDiagnostics.psm1 - execution of scripts is disabled on this system.
original title: file c:\windows\system32\WindowsPowerShell\v.1a\modules\psDiagnostics\psDiagnostics.psm1 cannot be loaded because the execution of scripts is disable on this system.
Remember - this is a public forum so never post private information such as numbers of mail or telephone!
Ideas:
- Disable programs you Wira c:\windows\system32\WindowsPowerShell\v.1a\modules\psDiagnostics\psDiagnostics.psm1 cannot be loaded because the execution of scripts is on this system.e of problems with
- Error messages
- Recent changes to your computer
- What you have already tried to solve the problem
Run scripts.
To secure Windows PowerShell, the default on Windows PowerShell execution policy is restricted. This strategy allows you to run cmdlets, but not scripts. To run scripts, use the Set-ExecutionPolicy cmdlet to change the AllSigned and RemoteSignedexecution policy. Only members of the Administrators group on the computer can run this cmdlet.
-
The execution of Scripts is disabled
I remember - this is a public forum so never post private information such as numbers of mail or telephone!
Ideas:
- Keep getting a warning Message on execution of Powershell Scripts is disabled on System.Is this supposed to be in the measuring mode? And if so, no matter what ideas how to do this? THANK YOU MUCH FOR YOUR TIME... You have problems with programs
- Error messages
- Recent changes to your computer
- What you have already tried to solve the problem
Michael Tothill
Information on the execution of script in Powershell is available here http://technet.microsoft.com/en-gb/library/ee176949.aspx
What you see is the default behavior. You need to change the ExecutionPolicy.
-
Get the stock vCO Powershell hosts
Hello
Does anyone know how to get Powershell hosts of the vCO stock of the script?
I would like to run a script on several hosts of Powershell without specifying each (this list of construction and provision of a table would be a good solution).
Thanks for your help
var psHosts = Server.findAllForType ("PowerShell:PowerShellHost", null);
-
Add a PowerShell host workflow question
Hello people,
I ran into a problem when I tried to run the add a workflow host Powershell.
Here's what I've done so now...
Installed PowerShell plugin in the system of the vCO.
WinRM service that is configured according to the doc in my vCO server... I want to use the same vCO as a powershell host server too...
I created the krb5.conf file in the installation of vCO location mentioned in the doc.
Ran the workflow manage SSL certificates which was a success.
Now I have to add this as a host of powershell to see in the inventory which fails with the error below.
Connection timed out: connect (name of the dynamic Script Module: addPowerShellHost #16)
Your help is very appreciated!
Kind regards
VMSavvy
1. I suggest to add "-a: option of the Kerberos test to connect to the winrm service" This will ensure that the mechanisym of Kerberos authentication is used.
> winrm identity-r:https:// host_name : port_number -was: Kerberos-sup: user_name Pei:password
2. try to connect vCO PowerShell plugin using shared session and providing user specifiv credentials (but be sure first that this user has enough privileges to connect to the WinRm service using winrm client)
> winrm identity-r:https:// host_name : port_number -was: Kerberos-sup: user_name Pei:password
3. could you give the error reported in vCO?
-
ps1 script could not be loaded because the execution of scripts is disabled on this system
I just loaded PowerShell and Toolkit VI on my new laptop computer and I get the following security error "snapshot.ps1 cannot be loaded because the execution of scripts is disabled on.
This system ". What authorization security or politics I need to change to fix this?
Hello
The Set-ExecutionPolicy changes the user preference for the shell execution policy. The execution policy is part of the Windows PowerShell security strategy. It determines if you can load configuration (including your Windows PowerShell profile) files and run scripts, and it determines which scripts, if any, must be digitally signed before they will work.
You must set the executionpolicy unrestricted by using the cmdlet below
set-executionpolicy unrestricted
get-executionpolicy will return the current executionpolicy.
Thank you
Christel
-
By editing the other scripts, I found here and other sites (including the labels size rorohiko), I worked on a script that will each image with the dimensions of the label and calculate the percentage of the spread of everything (including the text, white space).
Now, I was invited to a script that tagged the images with the percentage of total image on a gap space. This script is so space images on a total gap, then tag each image with the percentage of the total image space. For example if there is an image that is 10 x 10 inches and four pictures that are images of 2.5x2.5, 10 x 10 would be tagged with 50% and the 2.5x2.5 would be tagged with 12.5%.
This is the script that does the percentage of total circulation. Can some clever person get to do what I need?
Suze
(Sorry, I don't know how to post the script here with line numbers!)
//
This script adds printing of information labels to each graphic image. The labels are on a separate layer
named "PercentageLabels" so that all these added labels can be removed again by simply removing
the layer.
//
If you move or resize items, simply re-run the script to update the labels.
//
Before (re) start the script, you can define a paragraph style "SizeLabelStyle".
This style will apply to all content on labels.
//
Before (re) start the script, you can set a style of object 'SizeLabelObjectStyle '.
This style of object apply to all executives of the label - so if you want a specific background
fill out or frame, do it through this object style.
//
You can change the units of the size label. I put in inches. Change the line below that has
kUnitToUse - you can use:
MeasurementUnits.CENTIMETERS
MeasurementUnits.CICERO
MeasurementUnits.INCHES
MeasurementUnits.MILLIMETERS
MeasurementUnits.PICAS
MeasurementUnits.PIXELS
MeasurementUnits.POINTS
//
By default the script will not attempt to label the "nested" images If you also want to label
nested images (for example inline images, anchored frames, pasted images in the images,...) to change the line
below to read:
kLabelNestedItems = 1
//
If you want a specific image to stay without a label, you can use the Script label palette for
assign a script called 'ignore' for this frame. The script will then not label this framework to the
the title of the script is removed again.
//
Change the lines with kDontLabelImageFrames, kDontLabelTextFrames, kDontLabelOtherFrames
below if you want to restrict labelling to only certain types of images: replace the '0'
in "1" to enable these options.
//
Change the line with kShowImageFileName if you also want to display the names of the image in the
size for the picture frames.
//
Small frames are not labelled - the cutoff point is currently a less than 0.1 inch high framework
or 0.1 inch wide. You can change the cutoff point by adjusting the lines with kDontLabelBelowWidth
or kDontLabelBelowHeight below.
//
var Girard;
var gScriptFile;
var gCaches;
// ****************
That's cheating spread automatically calculated
var doc = app.activeDocument;
doc.viewPreferences.horizontalMeasurementUnits = MeasurementUnits.inches;
doc.viewPreferences.verticalMeasurementUnits = MeasurementUnits.inches;
PageWidth = doc.documentPreferences.pageWidth var;
stucture var pagewidth = * 2;
var spreadheight = doc.documentPreferences.pageHeight;
var spreadsquinch = stucture * spreadheight;
Alert ("the total measure of square inch of spread is:" + spreadsquinch);
//******************
VR;
{
If (app.activeScript instanceof file)
{
var gScriptFile = app.activeScript;
}
}
catch (Girard)
{
}
If (typeof (kLogLevel) is "undefined")
{
const kLogLevel = 5;
const kMaxLogNestLevel = 5;
const kLogToMessageBox = 0;
const kLogToConsole = 0;
const kLogToFile = 0;
const kLogFileName = "PercentageLabels.log";
const kIgnoreFrameLabel = "ignore."
const kSizeLabelLayerName = "PercentageLabels";
const kLabelNestedItems = 0;
const kDontLabelImageFrames = 0;
const kDontLabelTextFrames = 1;
const kDontLabelOtherFrames = 0;
const kUnitToUse = MeasurementUnits.INCHES;
const kShowImageFileName = 0; This set to 1 to precede the name of the image file in the tag
Below all of the measures are expressed in kUnitToUse (e.g. inches if MeasurementUnits.INCHES is used)
const kRoundToDecimals = 2;
The separator to use between objects - for example MyImage.jpg - 7.22 x 9,34
const kSeparatorBetweenNameAndSize = "-";
const kSeparatorBetweenHeightAndWidth = "H x"; "
const kSeparatorAfterWidth = "W";
const kDontLabelBelowWidth = 0.1; In kUnitToUse
const kDontLabelBelowHeight = 0.1; In kUnitToUse
const kLabelStyleName = "SizeLabelStyle";
const kLabelObjectStyleName = "SizeLabelObjectStyle";
const kLabelHeight = 0.6; In kUnitToUse
const kLabelWidth = 2.5; Expressed in kUnitToUse (e.g., inches).
}
var gRunState =
{
logToMessageBox: kLogToMessageBox,
logToConsole: kLogToConsole,.
logToFile: kLogToFile,.
functionNestLevel: 0,
logFunctionEntry: true,
logFunctionExit: true,
logLevel: kLogLevel,.
logFileName: kLogFileName
};
Main();
// ****************
function ConvertToFrame (thePageItem)
{
/ * / / / LogEntry ("ConvertToFrame");
var retVal = thePageItem.getElements () [0];
/ * / / / LogExit ("ConvertToFrame");
Return retVal;
}
// ****************
function CollectionToArray (theCollection)
{
/ * / / / LogEntry ("CollectionToArray");
var retVal = theCollection.everyItem () .getElements () .slice (0);
/ * / / / LogExit ("CollectionToArray");
Return retVal;
}
// ****************
function GetImageFile (pageItem)
{
/ * / / / LogEntry ("GetImageFile");
var imageFile = null;
do
{
Try
{
pageItem = ConvertToFrame (pageItem);
If (!) (("allGraphics" in pageItem))
{
break;
}
var allGraphics = pageItem.allGraphics.slice (0);
If (allGraphics.length == 0)
{
break;
}
var chart = allGraphics [0];
var graphic.itemLink = link;
imageFile = new File (link.filePath);
}
catch (Girard)
{
}
}
While (false);
/ * / / / LogExit ("GetImageFile");
return imageFile.
}
// ****************
function GetImageName (pageItem)
{
/ * / / / LogEntry ("GetImageName");
var imageName = "";
do
{
var imageFile = GetImageFile (pageItem);
If (imageFile is nothing)
{
break;
}
imageName = imageFile.displayName;
}
While (false);
/ * / / / LogExit ("GetImageName");
return imageName;
}
// ****************
function GetOuterPageItem (pageItem)
{
/ * / / / LogEntry ("GetOuterPageItem");
var retVal = null;
do
{
Try
{
retVal = pageItem.parent;
If (retVal instanceof spread | retVal instanceof Page)
{
retVal = pageItem;
break;
}
If (retVal instanceof character)
{
retVal = GetOuterPageItem(retVal.parentTextFrames[0]);
break;
}
}
catch (Girard)
{
retVal = null;
}
}
While (false);
/ * / / / LogExit ("GetOuterPageItem");
Return retVal;
}
// ****************
function LogMessage (message, collapseLines)
{
If (gRunState.logToConsole)
{
$.writeln (message);
}
If (gRunState.logToFile)
{
var logFile = new file (gScriptFile.parent + "/" + gRunState.logFileName);
var now = new Date();
logFile.open ("a");
logFile.write (now.toString () + ":"+ message + "\n" ');
logFile.close ();
}
If (gRunState.logToMessageBox)
{
Alert (message);
}
}
// ****************
LogEntry (message) function
{
If (gRunState.logFunctionEntry)
{
If (gRunState.functionNestLevel < kMaxLogNestLevel) {}
for (var idx = 0; idx < gRunState.functionNestLevel; idx ++)
{
message = "" + message;
}
Filled (message + "<", true);
}
}
gRunState.functionNestLevel ++;
}
// ****************
function LogError (message)
{
If (gRunState.logLevel > = 1).
{
LogMessage ("* ERROR *:" + message, false);
}
}
// ****************
function LogExit (message)
{
-gRunState.functionNestLevel;
If (gRunState.functionNestLevel < 0)
{
LogError ("LogExit: unbalanced nesting of function");
}
If (gRunState.logFunctionExit)
{
If (gRunState.functionNestLevel < kMaxLogNestLevel) {}
for (var idx = 0; idx < gRunState.functionNestLevel; idx ++)
{
message = "" + message;
}
Filled (message + ">", true);
}
}
}
// ****************
function LogNote (message)
{
If (gRunState.logLevel > = 3)
{
LogMessage ("Note:" + message, false);
}
}
// ****************
function LogWarning (message)
{
If (gRunState.logLevel > = 2)
{
LogMessage ("WARNING:" + message, false);
}
}
// ****************
function Main()
{
/ * / / / LogEntry ("Main");
var savedUserInteractionLevel = app.scriptPreferences.userInteractionLevel;
app.scriptPreferences.userInteractionLevel = UserInteractionLevels.NEVER_INTERACT;
do
{
Try
{
activeDocument var = app.activeDocument;
If (!.) (activeDocument instanceof Document))
{
LogError ("hand: activeDocument isn't a Document");
break;
}
var savedHorizontalMeasurementUnits = activeDocument.viewPreferences.horizontalMeasurementUnits;
activeDocument.viewPreferences.horizontalMeasurementUnits = kUnitToUse;
var savedVerticalMeasurementUnits = activeDocument.viewPreferences.verticalMeasurementUnits;
activeDocument.viewPreferences.verticalMeasurementUnits = kUnitToUse;
var savedRulerOrigin = activeDocument.viewPreferences.rulerOrigin;
activeDocument.viewPreferences.rulerOrigin = RulerOrigin.PAGE_ORIGIN;
do
{
Try
{
ProcessFrames (activeDocument);
}
catch (Girard)
{
Alert ("the script encountered a situation that we don't know how to handle. "He received the error, says '" + Parker + "' in Main()"); "."
}
}
While (false);
activeDocument.viewPreferences.rulerOrigin = savedRulerOrigin;
activeDocument.viewPreferences.horizontalMeasurementUnits = savedHorizontalMeasurementUnits;
activeDocument.viewPreferences.verticalMeasurementUnits = savedVerticalMeasurementUnits;
}
catch (Girard)
{
Alert ("the script encountered a situation that we don't know how to handle. "He received the error, says '" + Parker + "' in Main()"); "."
LogError ("Hand throw" + Girard);
}
}
While (false);
app.scriptPreferences.userInteractionLevel = savedUserInteractionLevel;
/ * / / / LogExit ("Main");
}
// ****************
function ProcessFrames (doc)
{
/ * / / / LogEntry ("ProcessFrames");
var err;
do
{
If (!.) (doc instanceof Document))
{
LogError ("ProcessFrames: doc should be a Document");
break;
}
Try
{
var existingLayer = doc.layers.itemByName (kSizeLabelLayerName);
existingLayer.id;
existingLayer.remove ();
}
catch (err)
{
}
If (kLabelNestedItems)
{
var pageItems = doc.allPageItems.slice (0);
}
on the other
{
var pageItems = CollectionToArray (doc.pageItems);
}
var frameReferences = [];
for (var pageItemIdx = 0; pageItemIdx < pageItems.length; pageItemIdx ++)
{
do
{
var pageItem = pageItems [pageItemIdx];
If (pageItem.itemLayer.name is kSizeLabelLayerName)
{
break;
}
var pageItem = ConvertToFrame (pageItem);
If (instanceof TextFrame pageItem)
{
If (kDontLabelTextFrames)
{
break;
}
}
ElseIf (pageItem graphic instanceof)
{
If (kDontLabelImageFrames)
{
break;
}
}
on the other
{
If (kDontLabelOtherFrames)
{
break;
}
}
If (pageItem.label.toLowerCase () is kIgnoreFrameLabel)
{
break;
}
var width = pageItem.geometricBounds [3] - pageItem.geometricBounds [1];
var height = pageItem.geometricBounds [2] - pageItem.geometricBounds [0];
If (width < kDontLabelBelowWidth)
{
break;
}
If (height, kDontLabelBelowHeight)
{
break;
}
frameReferences.push (pageItem);
}
While (false);
}
var sizeLabelLayer = doc.layers.add ({name: kSizeLabelLayerName});
for (var pageItemIdx = 0; pageItemIdx < frameReferences.length; pageItemIdx ++)
{
Try
{
var pageItem = frameReferences [pageItemIdx];
var width = pageItem.geometricBounds [3] - pageItem.geometricBounds [1];
var height = pageItem.geometricBounds [2] - pageItem.geometricBounds [0];
var labelItem = doc.textFrames.add (null, LocationOptions.BEFORE, GetOuterPageItem (pageItem));
labelItem.itemLayer = sizeLabelLayer;
var boxsquinch = width * height
var boxpercent = (boxsquinch / spreadsquinch) * 100
var roundpercent = Math.round (boxpercent)
var labelText = "";
If (kShowImageFileName)
{
var imageName = GetImageName (pageItem);
If (imageName! = "")
{
labelText += imageName + kSeparatorBetweenNameAndSize;
}
}
labelText += RoundString (height, kRoundToDecimals) + kSeparatorBetweenHeightAndWidth + RoundString(width, kRoundToDecimals) + kSeparatorAfterWidth + ' \r\n'+ roundpercent + '% ';
labelItem.contents = labelText;
xPos = pageItem.geometricBounds var [1];
yPos = pageItem.geometricBounds var [0] + kLabelHeight;
labelItem.geometricBounds is [Posy, xPos, yPos + kLabelHeight, xPos + kLabelWidth];.
Try
{
labelItem.parentStory.characters.everyItem () .appliedCharacterStyle = doc.characterStyles.item (0);
}
catch (err)
{
}
Try
{
labelItem.parentStory.paragraphs.everyItem () .appliedParagraphStyle = kLabelStyleName;
}
catch (err)
{
}
Try
{
labelItem.appliedObjectStyle = doc.objectStyles.itemByName (kLabelObjectStyleName);
}
catch (err)
{
}
}
catch (err)
{
}
}
}
While (false);
/ * / / / LogExit ("ProcessFrames");
}
// ****************
function RoundString (numVal, decimal)
{
/ * / / / LogEntry ("Round");
var retVal = Math.round (numVal * Math.pow(10,decimals)) + "";
retVal = retVal.substring(0,retVal.length-decimals) + "." + retVal.substring(retVal.length-decimals);
/ * / / / LogExit ("Round");
Return retVal;
}
What do you mean?
var myDoc = app.activeDocument; var mySpreads = myDoc.spreads; var myRectangles = myDoc.rectangles; var myImages = 0; for (var i = 0; i < mySpreads.length; i++) { var mySpreadWidth = 0; var mySpreadHeight = myDoc.documentPreferences.pageHeight; for (var j = 0; j < mySpreads[i].pages.length; j++) { mySpreadWidth += myDoc.documentPreferences.pageWidth; } var mySpreadArea = mySpreadWidth * mySpreadHeight; var myImages = mySpreads[i].rectangles; var myTotalImageArea = 0; var myIndividualImageArea = []; for (var j = 0; j < myImages.length; j++) { var myImageGeometricBounds = myImages[j].geometricBounds; var myImageWidth = myImageGeometricBounds[3] - myImageGeometricBounds[1]; var myImageHeight = myImageGeometricBounds[2] - myImageGeometricBounds[0]; myIndividualImageArea[j] = (myImageWidth * myImageHeight); myTotalImageArea += myIndividualImageArea[j]; } for (var j = 0; j < myIndividualImageArea.length; j++) { alert("Image percentage of total images on spread " + (i + 1) + " = " + (myIndividualImageArea[j] * 100) /myTotalImageArea); } alert("Total image percentage on spread " + (i + 1) + " = " + myTotalImageArea); }
-
VSphere Orchestrator (vco) - problem to add a Powershell host
Hello world
I am currently set up a VSphere Orchestrator server and I have a few problems to add a new host via WinRM with Add a PowerShell host model.
I followed this tutorial:
I can connect with Powershell to a second server HTTPS but not with the vco...
This is my setup:
PS WSMan:\localhost\Client> winrm get winrm/config Config MaxEnvelopeSizekb = 500 MaxTimeoutms = 60000 MaxBatchItems = 32000 MaxProviderRequests = 4294967295 Client NetworkDelayms = 5000 URLPrefix = wsman AllowUnencrypted = true Auth Basic = true Digest = true Kerberos = true Negotiate = true Certificate = true CredSSP = false DefaultPorts HTTP = 5985 HTTPS = 5986 TrustedHosts Service RootSDDL = O:NSG:BAD:P(A;;GA;;;BA)(A;;GR;;;IU)S:P(AU;FA;GA;;;WD)(AU;SA;GXGW;;;WD) MaxConcurrentOperations = 4294967295 MaxConcurrentOperationsPerUser = 1500 EnumerationTimeoutms = 240000 MaxConnections = 300 MaxPacketRetrievalTimeSeconds = 120 AllowUnencrypted = true Auth Basic = true Kerberos = true Negotiate = true Certificate = false CredSSP = false CbtHardeningLevel = Relaxed DefaultPorts HTTP = 5985 HTTPS = 5986 IPv4Filter = * IPv6Filter = * EnableCompatibilityHttpListener = false EnableCompatibilityHttpsListener = false CertificateThumbprint AllowRemoteAccess = true Winrs AllowRemoteShellAccess = true IdleTimeout = 7200000 MaxConcurrentUsers = 10 MaxShellRunTime = 2147483647 MaxProcessesPerShell = 25 MaxMemoryPerShellMB = 1024 MaxShellsPerUser = 30
PS WSMan:\localhost\Client> winrm enumerate winrm/config/listener Listener Address = * Transport = HTTP Port = 5985 Hostname Enabled = true URLPrefix = wsman CertificateThumbprint ListeningOn = 127.0.0.1, 169.254.152.175, 192.168.1.139, ::1, 2001:0:5ef5:79fb:2087:3306:fde2:7302, fe80::5efe:192.168.1.139%14, fe80::2087:3306:fde2:7302%15, fe80::c19d:d401:ff68:98af%13, fe80::c407:cc5e:43dc:6909%18 Listener Address = * Transport = HTTPS Port = 5986 Hostname = host-vsphere.urbanvirtu.local Enabled = true URLPrefix = wsman CertificateThumbprint = 4f00d909810f619876bf5712a22e0fb21382d628 ListeningOn = 127.0.0.1, 169.254.152.175, 192.168.1.139, ::1, 2001:0:5ef5:79fb:2087:3306:fde2:7302, fe80::5efe:192.168.1.139%14, fe80::2087:3306:fde2:7302%15, fe80::c19d:d401:ff68:98af%13, fe80::c407:cc5e:43dc:6909%18
If I try to connect from a second server via Kerberos with HTTPS it works:
PS C:\Users\Administrator> winrm identify -r:https://host-vsphere.urbanvirtu.local:5986 -a:Kerberos -u:administrator -p:password IdentifyResponse ProtocolVersion = http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd ProductVendor = Microsoft Corporation ProductVersion = OS: 6.3.9600 SP: 0.0 Stack: 3.0 SecurityProfiles SecurityProfileName = http://schemas.dmtf.org/wbem/wsman/1/wsman/secprofile/http/basic, http://schemas.dmtf.org/ wbem/wsman/1/wsman/secprofile/https/basic, http://schemas.dmtf.org/wbem/wsman/1/wsman/secprofile/http/spnego-kerberos, h ttp://schemas.dmtf.org/wbem/wsman/1/wsman/secprofile/https/spnego-kerberos
But with the vco I:
Name: test
The Host/IP: Home - vsphere.urbanvirtu.local
Port: 5986
Type remote PowerShell: WinRM
Transport protocol: HTTPS
Authentication: Kerberos
Session mode: A shared Session
User name: administrator
Password: password
Someone has had this problem before? What I did wrong?
Thanks in advance for your help.
Best regards
Jean
Based on the log, I see that "Connection refused:" error was connected to the kdc parameter in the krb5.conf file and you have already defeated it.
Now, if I understand 'Add a PowerShell host' the workflow remains in working condition and does not end.
This behavior I observed in the case of PowerShell plugin 1.0.3 is trying to connect to PowerShell host running PowerShell 4.0.
Would you please provide version of
the PowerShell vCO plugin version
PowerShell host - Windows Version
PowerShell host - PowerShell version
-
Need a script Powershell inventory VM
Hello
Need a script powershell to collect them below, has held information from the virtual Center.
vmname | Name of ESX. Memory (GB) | County of vCPU | vNIC County | IP address (all) | VMDK (s) size (GB) | Total size (GB) vmdk | Name of the data store. The Tools version. to update the tools | actions | Reservations (MB) | Limit (MB) | County snapshot | Guest operating system
VMDK (s) size (GB)-> need all size vmdk from the separated from the vm by ''. EX: for a virtual machine of 3 size vmdk 20,20, 10 GB each the output would be 2020 + 10
The name of the data store-> name of the data store where the VMX.
Update of the tools-> State of necessity as old or updates
You will find the combined VM version of script 3 attached information. If you want only some of the fields, as in the VMX and VMDK script, you can use the Select-Object cmdlet to select only the fields. The next oneliner will use the script Get-information - v3.ps1 to generate the output of the VMX and VMDK script:
./Get-VMInformation-v3.ps1 | Select-Object -property VMname,VMXName,VMDKName,VmdkSizeGB,TotalVmdkSizeGB,DatastoreName
Robert
-
Script PowerShell to enter all hosts ESX MAC address
I tried to find a way to use powershell to enter all ESX host MAC addresses in a specific data center. If someone has something that can be useful, please let me know. I'm puzzled.
Is that what you are looking for?
$dcName =
Get-Datacenter -Name $dcName | Get-VMHost | %{ $esx = $_ $_ | Get-VMHostNetworkAdapter | ` select @{N="ESXname";E={$esx.Name}},DeviceName,Mac } ____________
Blog: LucD notes
Twitter: lucd22
-
Hello
I run the below script but you want to change it so that I can add the Maximum available CPU and % CPU used statistics in the table by a calculation, I just get the syntax right as you will see highlighted below.
I would really appreciate the help.
Thank you
Dan
$Report = @)
$ESXHosts = get-VMHost | Sort name | Get-View
ForEach ($ESXHost to $ESXHosts)
{
$ReportObj = "" | Select the name, 'Active VMotion', 'Connection status', "Global CPU", "Max CPU", "% CPU used.
$ReportObj.Name = $ESXHost.Name
$ReportObj. "" VMotion enabled "= $ESXHost.summary.config.vmotionenabled
$ReportObj. "" Connection status "= $ESXHost.summary.runtime.connectionstate
$ReportObj. "" Overall CPU "= $ESXHost.summary.quickStats.overallCpuUsage
$ReportObj. "" Max CPU "= (($ESXHost.summary.NumCpuCores$ESXHost.summary.NumCpuPkgs$ESXHost.summary.CpuMhz))
$ReportObj. "" CPU % used "= (($ESXHost.summary.quickStats.overallCpuUsage)/ (($ESXHost.summary.NumCpuCores$ESXHost.summary.NumCpuPkgs$ESXHost.summary.CpuMhz))) )
$Report += $ReportObj
}
$Report | ConvertTo-Html-of title 'Advanced Host' - body "& lt; H4 & gt; Advanced Host Information & lt; / H4 & gt; » | Out-file - add $filelocation
Sorry, take out the quotes.
$ReportObj. (' ' Max CPU "= ($ESXHost.summary.hardware.NumCpuCores) *($ESXHost.summary.hardware.CpuMhz))
-
PowerShell host - window vRO 6.0.2
Hello
I try to configure the host powershell on vRO 6.0.2 installed on Windows 2012R2. When I run the workflow I get the error message "cannot locate the default domain (the name of the dynamic Script Module: addPowershellHost #).
I'm trying to locate the krb5.conf file but there is no path c:\Program Files VMware vCenter Server - Java Components\lib\security I only c:\Program Files\Common Files\VMware.
When I set up host using Basic authentication and Administrator local, everything is Ok.
Kind regards.
Pawel
Hi Pawel,
try to store the krb5.conf in this path: C:\Program Files\VMware\CIS\jre\lib\security
(This works fine for me)
Kind regards
Marc
-
VSphere Management Assistant freezes during execution of scripts Perl SDK
In our environment, we have a nagios server which connects to our Executive Assistant to check the health of our host ESX 4.1 vSphere. Scripts are pretty basic and just run over SSH using cryptographic keys every 10 minutes. The problem is that after a day or so to work properly the VMA one freezes and unresponsive. I am at a loss here as to what is causing this problem that I made sure to always disconnect the server vSphere when scripts are finished. Anyone who has met by this kind of problem before?
Here is one of my scripts for reference:
check_cpu:
#!/usr/bin/perl -w use strict; use warnings; use FindBin; use lib "$FindBin::Bin/../"; use VMware::VIRuntime; use VMware::VmaTargetLib; my $host = $ARGV[0]; my $warn = $ARGV[1]; my $crit = $ARGV[2]; if ( $host eq '' || $warn eq '' || $crit eq '' ) { print "Usage: check_cpu <SHORT HOSTNAME> <WARNING LEVEL> <CRITICAL LEVEL>\n"; exit (0); } my $target; $target = VmaTargetLib::query_target("vcenterserver.***.****.****"); $target->login(); my $entity_views; &main(); sub main { &get_views(); &get_cpu(); } sub logout { $target->logout(); } sub get_views { $entity_views = Vim::find_entity_views( view_type => 'HostSystem', filter => { 'summary.config.name' => "$host.***.****.***" }, ); if ( @{$entity_views} == 0 ) { print "Error: Host does not exist! Exit 2\n"; &logout(); exit (2); } } sub get_cpu { for my $entity (@{$entity_views}) { my $status = $entity->runtime->standbyMode; if ( $status eq 'none' ) { my $totalMhz = $entity->summary->hardware->cpuMhz; my $cpuCores = $entity->summary->hardware->numCpuThreads; my $cpuUsage = $entity->summary->quickStats->overallCpuUsage; my $cpuPerc = ($cpuUsage/($totalMhz*$cpuCores))*100; if ( $cpuPerc < $warn ) { print "CPU at $cpuPerc\%. Exit 0.\n"; &logout(); exit (0); } elsif ( $cpuPerc < $crit ) { print "Warning! CPU at $cpuPerc\%. Exit 1\n"; &logout(); exit (1); } else { print "Critical! CPU at $cpuPerc\%. Exit 2\n"; &logout(); exit (2); } } else { print "\tHost $host is in standby mode. Exit 0\n"; &logout(); exit(0); } print "\n"; } }
Thank you
You monitor the execution of your hosts vMA during execution of the script? By default, it is configured with only 1vCPU and 512 MB of memory, based on the query and the size of your environment it may be running out of resources that I saw myself, and generally I'll upgrade the memory to 1 GB, if not slightly more depending on what he does. It's probably a good idea to take a look at the performance of your vSphere environment and see what it consumes and if the system is swapping or pegging on CPU.
Maybe you are looking for
-
How to save the pages that I open in a single window as a tab group?
In Internet Explorer, I am able to "Add current tabs to Favorites" for all my pages are saved as a tab group. How do I do this in Firefox?
-
Satellite C660D - how to change USB 1.0 to 2.0?
I have a SATELLITE C660D-102 and can not find a deivere update my usb im stuck on usb 1.0 my laptop supports usb 2.0 but it is not work dose anyone know how to fix this?
-
On Satellite Pro L20 battery is not
Hello new to this and not a technical person, please bear with me! My laptop will not charge the battery. the laptop works plugged whn in the socket. I also bought another battery and still does not support. When I clik on th battery info it says rem
-
Install not the more updates - was a success on 1 / 4 today. I did a fix on windows update in aggressive and default mode. How to get out this situation where it maintains for the lack of update of windows?
-
Update for AMD driver graphics high definition
I have a HP Pavilion g6 Notebook LW350UA #ABA 64-bit Windows 7 operating system. Tune is offer me an update for AMD driver graphics high definition. It crosses the slip with the Green checkmarks next to them all the way to the end of the download.