Having a very bad Friday afternoon, no idea how I can eliminate a possible race condition? I have a working script intermittently :(
I have a script that seems to work intermittently, usually it fails on the line of characters 1 128 (in bold below) I think that the VC will not return with information and therefore the script fails on the capture...
on the other
{
Write-Host "space is insufficient on the target data store. Please increase the space to continue.
Write-Output "space is insufficient on the target data store. Please increase the space to continue"> > $logfile
Write-Host "Exiting with code 1.
Write-Output "exit with code 1" > > $logfile
Send-MailMessage-to $From-$To-CC $Cc - subject $Subject '
-Body $BodyFailure1 - SmtpServer $SMTPServer - port $SMTPPort
Output 1
The architect suggested it might be a race condition, can someone with a lot more experience than me (it's pretty anyone) suggests an alteration that may well solve this problem? I guess I could put breaks in but I'm not 100% where would be the best place to do so or if maybe it's the mickey mouse method?
Error
# ==============================================================================================
# NAME: CloneVMs
#
# AUTHOR: Luc
# DATE: 10/09/2015
#
# COMMENT: Creates a clone/backup of virtual machines described in the text and names using the
# past param. Virtual MACHINE will be appointed in accordance with the following VM1-12345678 example
#
#
#
# * Software dependencies: *.
# - Microsoft PowerShell *.
# - VMWare PowerCLI *.
# ==============================================================================================
# Parameters
# ==============================================================================================
# Below is provided by Control-M parameter refers to the prefix point cycle and restoration,
# the date can be added automatically, however, this feature has been disabled.
Param ([string] $CYRPYYMMDD)
# ==============================================================================================
# Functions
# ==============================================================================================
#Function for you to check if a command is responsible
Function Check-Command ($cmdname)
{
return [bool] (Get-Command - Name $cmdname - ErrorAction SilentlyContinue)
}
# ==============================================================================================
# Varibles
# ==============================================================================================
# Add the snap of vmware for powershell
# Add - PSSnapin VMware.VimAutomation.Core
# Add the snap of vmware for powershell (keeps see you error messages)
If (control "Connect-VIServer")
{
Write-Host "already automation tool for".
}
on the other
{
#If not already loaded load the snap
Write-Host "loading automation tools.
Add-PSSnapin VMware.VimAutomation.Core
}
backup of # = true adds date; false creates a clone with the same name.
$backup = 'True '.
debugging of #-true: clones not vm. FALSE will clone the virtual machine.
$debug = "FALSE".
# Target Datastore
$targetdatastore = "LUN9_BASIC_MATADM_ONLY".
Check the #Refers the percentage of free space for space DS
$freePerc = 10
# Target location - folder existing in vcenter structure, where the clones will be held
$targetlocation = "DMAT DNT for Cycles compatibleM BackUp.
# Set a date
$datestart = (get-date - uformat %Y %m %d)
# Name a log file to record the results.
$logfile = $datestart + "_VMClones_bulk.txt".
#
Write-output "new journal ($datestart) - ($logfile)" > > $logfile
# Gets the list of virtual machines from the file associated with this script
$VmFileList = get-Content VmsToCloneList.list | Select-Object - jump 3
#
$ds = get-Datastore-name $targetdatastore
#Email varibles
$From = «»
$To = «»
$Cc = «»
#$Attachment = "C:\temp\Some random file.txt".
$Subject = «!» DMAT TEST createRP TEST! »
$BodySuccess = "A DMAT VM has correctly saved to the specified folder of destination organizational data store and inventory in vSphere"
$BodyFailure1 = "the combined use of VMDK put in service of the virtual machine is greater than the capacity of the destination database or the datstore does not exist, coming out with code 1"
$BodyFailure2 = "there is not enough space on the target data store, increase the space to continue, exit with code 1"
$BodyFailure3 = "a virtual machine with the specified name is not found maybe it does not exist? Exit with code 1 "
$SMTPServer = «»
$SMTPPort = "25".
# Connect
$Creds = get-VICredentialStoreItem-Host 127.0.0.1 - folder C:\Users\matadm\PS_ITC_BAS.xml
SE connect-VIServer 127.0.0.1-$ username-password Creds.User $Creds.Password
# Gets the total ProvisionedSpaceGB of VM for all s VM in the list.
# Ensures whitespace and hashes are effectively ignored
# create a clean list that calculates / creates the variable required for the validation check 1
$vmCleanedList = New-Object system. Collections.ArrayList
# Loop through our VM file list and own is in place, check for incorrectly specified VM
ForEach ($vmname to $VmFileList)
{
If ([string]: IsNullOrWhiteSpace ($vmname) - or $vmname.) StartsWith("#"))
{
writing-host("Invalid machine name-$vmname")
}
on the other
{
#Should trim vmname to ensure that we have no spaces before or the end
$vm = get - VM $vmname
$vmCleanedList.Add ($vmname)
$TotalRequiredGB += $vm. ProvisionedSpaceGB
}
Write-Host "Total needed = $TotalRequiredGB.
}
# ==============================================================================================
# Validation checks before launching the clone script
# ==============================================================================================
# Updates the prior to storage data store information.
$ds. ExtensionData.RefreshDatastoreStorageInfo)
# Validation check 1, check if the combined usage of VMDK put into service of the virtual machine is greater than the capacity of the destination database?
If (($ds.)) FreeSpaceGB - gt $TotalRequiredGB))
{
Write-Host 'continue with your script.
}
on the other
{
Write-Host "space is insufficient on the target data store. Please increase the space to continue.
Write-Output "space is insufficient on the target data store. Please increase the space to continue"> > $logfile
Write-Host "Exiting with code 1.
Write-Output "exit with code 1" > > $logfile
Send-MailMessage-to $From-$To-CC $Cc - subject $Subject '
-Body $BodyFailure1 - SmtpServer $SMTPServer - port $SMTPPort
Output 1
}
$ds = get-Datastore-name $targetdatastore
# 2 validation control, you have X % datatstorespace free?
If ((($ds.)) FreeSpaceGB / $ds. CapacityGB) * 100)-ge $freePerc)
{
Write-Host 'continue with your script.
}
on the other
{
Write-Host "there is less than X % of free space on the data store. Please increase the space to continue.
Write-Output "there less than X % of free space on the data store. Please increase the space to continue"> > $logfile
Write-Host "Exiting with code 2.
Write-Output 'output with code 2' > > $logfile
Send-MailMessage-to $From-$To-CC $Cc - subject $Subject '
-Body $BodyFailure2 - SmtpServer $SMTPServer - port $SMTPPort
Output 2
}
#Hack + of the duplication of efforts
#$VmListFile = get-Content VmsToCloneList.list | Select-Object - jump 3
ForEach ($vmname to $vmCleanedList)
{
# The virtual computer object
$vm = get-VM-name $vmname
# Target host - use the same host as the current VM (it's faster than the cloning on hosts).
$targethost = $vm.vmhost.name
# Target VM name - name if the BACKUP is FALSE
$vmtarget = $vmname
#
$datastore = get-datastore $targetdatastore - vmhost $targethost
# ==============================================================================================
# Start the real clone script
# ==============================================================================================
If ($vm - no $null)
{
Write-Host "a virtual machine named $VM exists. From clone "
Write-output "a virtual machine named $VM exists. From clone"> > $logfile
}
on the other
{
Write-Host "a virtual machine with the specified name is not found maybe it does not exist?
Write-Output "a virtual machine with the specified name is not found there is perhaps no?" > > $logfile
Write-Host "Exiting with code 3.
Write-Output "output with code 3" > > $logfile
Send-MailMessage-to $From-$To-CC $Cc - subject $Subject '
-Body $BodyFailure3 - SmtpServer $SMTPServer - port $SMTPPort
exit 3
}
If ($backup - eq "TRUE")
{
# Clone the virtual machine for backup_vmname_todaysdate
$vmtarget = $vmtarget + '-' + $CYRPYYMMDD #+ '-' + $datestart
}
beautiful colors # if you look at the script runs
write-host - foregroundcolor green 'cloning $vm to $vmtarget.
Write-output - foregroundcolor green 'Cloning $vm to $vmtarget' > > $logfile
new-vm-name $vmtarget - vm $vm vmhost - $targethost - $datastore - $targetlocation location data store - slim DiskStorageFormat
Send-MailMessage-to $From-$To-CC $Cc - subject $Subject '
-Body $BodySuccess - SmtpServer $SMTPServer - port $SMTPPort
}
Write-Host "complete."
Exit 0
# COMPLETED
Have you ever tried to test if $ds-eq $null before you call the RefreshDatastoreStorageInfo method?
In the error message, it looks like $ds contains $null, no idea why when the data store 'LUN9_BASIC_MATADM_ONLY' exists in the environment in which you are conencted.
In fact, you could test immediately after the Get-data store.
Ah, but wait, you seem to be doing the first Get-Datastore (there are two in the script, but I guess you know) before the connect-VIServer, it won't work.
Unless I'm missing something here
Tags: VMware
Similar Questions
-
Ideas:
- You have problems with programs
- Error messages
- Recent changes to your computer
- What you have already tried to solve the problem
Remember - this is a public forum so never post private information such as numbers of mail or telephone!
Suddenly, I have a small window constantly, opening and closing very quickly. I managed to be frozen and could read the following: the URL is C:\Windows\system32\cmd.exe
and the error message is:
The syntax of the command is incorrect
Intel® Viiv™
Parameters
No idea how I can get this to stop? I use Vista. Thank you.Okay, I think that I fixed it. I went in the Sys Config, Start Up and unchecked "common SDK-Sonic Solutions/Roxio." Also not controlled all the other stuff video I don't need at start-up. I then restarted it, of course. It has been a few hours now and no window flashing. Roxio is a nice program, but has been a problem on my computer. By auto-off starting this program, it seems to have solved the problem.
-
Computer has recently been corrected it now say windows is not genuine, go online to solve the problem. Windows validation does not any ideas how I can fix this
Visit: http://www.microsoft.com/genuine/diag/> and click on "start the Diagnostics.
IMPORTANT -online if you run Windows 7 or Vista 64-bit, you must Access the site via IE 32 bits only!]
`~`
Try the number listed here appropriate phone: phone numbers Microsoft Activation centers worldwide:
http://www.Microsoft.com/licensing/existing-customers/activation-centers.aspx>
`~`
If you are still not able to validate your Vista installation, follow these steps:
I. Download this diagnostic tool, save it to your desktop: http://go.microsoft.com/fwlink/?linkid=56062>
-Online Vista & Win7: right-click on the executable and select run as administrator to run the tool.
II. after running the tool, click on the button continue, and then click the copy button (to the Clipboard).
NB: You can open a new file in Notepad, paste the contents of the Clipboard in it & keep for future reference.
III. start a new thread in the following Microsoft Genuine Advantage forum and paste the results of the diagnosis of MGA tool in your post, and a clear description of your problem:
IV. A help desk specialist will analyze the data and recommend an appropriate solution.
UTC/GMT is 21:28 Friday, December 2, 2011
-
I have a version of the education of the CSuite 6 design and web premium. Bought a new mac without DVD drive and now I have no idea how I can install it on my laptop. S/N does not seem to work. Can anyone help?
CS6 - http://helpx.adobe.com/x-productkb/policy-pricing/cs6-product-downloads.html
You can also download the demo version of the software through the page linked below and then use your current serial number to activate it.
Don't forget to follow the steps described in the Note: very important Instructions in the section on the pages of this site download and have cookies turned on in your browser, otherwise the download will not work correctly.
CS6: http://prodesigntools.com/adobe-cs6-direct-download-links.html
-
I've recently upgraded to El Capitan - biggest problem is timing removed all the entries in my previous ical. Any ideas how I can track down the file containing these essential documents and install in the new program?
All calendars are enabled in the sidebar?
-
I have a HP 3510 and I want to scan to a word document an idea how I can do?
I have a HP 3510th printer all in one
I am running Windows 7 64 bit
I want to scan to a word doc. No idea how I can do?
Hello
Please follow the instructions below:
http://Office.Microsoft.com/en-AU/Word-Help/scan-and-edit-a-document-HA010254879.aspx
Kind regards.
-
Im trying to install my first than Pro CS4, the first disc installs fine but the 2nd disc refuses to install. I have searched a downloadable version, but can not find a. any ideas how I can actually complete installation?
Download & install instructions https://forums.adobe.com/thread/2003339 can help
-includes a link to access a page to download the Adobe programs if you do not have a disk or drive
-you will need to enter your original serial number during the installation for non-Cloud programs
- or kglad links in response to #1 here can help https://forums.adobe.com/thread/2081216
Also go to https://forums.adobe.com/community/creative_cloud/creative_cloud_faq
- and also read https://forums.adobe.com/thread/1146459
-
Hi all
I managed to remove the copyright off my Photoshop CS5 by error symbol one has an idea how I can get it back please.
Are you talking about the custom shape tool? These are part of the installation and do not disappear permanently. Just go to the menu drop-down and click 'all', and he'll be back.
-
Hello, I bought Adobe for download a few years ago and settled in on a Mac Pro. I want to uninstall on the mac and install it on a new Mac Pro. No idea how I can do?
Just download, install and activate using your serial number. You are allowed to have the software installed and enabled on both machines. If you do want to keep the original installation of backup you can turn it off by opening one of the programs and by selecting help-> Deactivate.
Here's a general link for where you can find the download links...
Download and Installation Help-
https://helpx.Adobe.com/download-install.html
If you want a more direct link, you must name the software and version.
If you need your serial number, you should be able to find it in your account Adobe online if you have registered the software when you install everything first.
-
I am interested in creating a batch file or executable that will keep track of all of the currently open windows (files and applications)
so that when Windows restarts I can more easily return to what I was doing before.This can be done either by connecting each operation on the file - open and remove items in the list when an item (file or window) is closed (logging only at this time here), or by checking every 5-10 seconds that windows and files are currently open.I tried using TaskList, and OpenFiles to it but cannot do things, plus those also do not provide a path to open files - I want to keep the paths so that the items can be recovered (reopening) with a single click. Any ideas how to do this? I use Windows 7 Professional.My idea is to have the possibility to go back to all that I was working on, without having to memorize the list... It is very useful for people who keep a lot of files and windows open most of the time, especially if for some reason any Windows crashes or stops the case (e.g. restart after an update...). MS Office products can do it (by saving temporary files and allows you to recover if the program was not closed properly), a Web browser can do (keeping a story and using the session management)-why Windows can't do?In addition, if there is such list of open windows and files then it might be possible to keep also some history and ' files/windows' recently closed, similar to how Google Chrome can show recently closed tab.The application that I'm developing (for my own personal use, although I would offer it to someone else) will be:-keep a history and a current list of open files/windows, including a path for each file opened.-Files/windows closed are removed from the list "now open" and moved to the list of "recently closed", which has a maximum length.-file/window close operations should be associated with the user control. Otherwise, opens the files that are closedby Windows when the judgment is no longer will be identified as open.-an option would be to ensure, somehow, that this request is always closed during a regular shutdown process first.-Another option is to simply assume that there is no problem, if Windows broke down, and that the user is reminded to close the application before you stop.-Another option is to have the traceable list, a user can go back a few steps up a point until Windows began to close.-Another option is to have the "last sitting" identified as, for example 2 minutes before closing, while keeping a list of items opened after that date.-list "recently closed" items that are too old (have been pushed to the bottom of the list and beyond of the length limit are moved to history.-l' history can be defined for a limited time or can be cleaned manually or automatically (periodically), or we can set a limit on the length for the history list.* the application/batch/executable is located in the Windows startup folder and it:-is launched at Windows startup-after start (automatically or manually) will display a dialog box containing a list of the items that were open before windows stop - see Creating session above.-user can deselect items in the list if he or she does not want to open them. "Uncheck the items of list moves to the ' recently closed" list or history.-by identifying which items are not kept, or simply to keep everything, the user clicks on a single button and the application opens to all items that are always enabled. To avoid slowing down the system, an option is available to open files, in which case a flow can be set. Defining a priority list, it is also an idea.If you think you have a good idea for this or want to work on it with me, please contact me at * address email is removed from the privacy *.If you are able to do it yourself, let me know.It all sounds very complicated for me, I wish you well in your efforts.
Here is what that will be helpful?
Handle v3.46
http://TechNet.Microsoft.com/en-us/Sysinternals/bb896655.aspxSysinternals process utilities
http://TechNet.Microsoft.com/en-us/Sysinternals/bb795533Sysinternals and disc utilities file
http://TechNet.Microsoft.com/en-us/Sysinternals/bb545046 -
Hello
Basically, as stated above, I have worked on songs uncheck that I don't want to hear in iTunes for a while, and today, I noticed that everything had been restored "checked". Note that this has nothing to do with the synchronization with a camera - I'm talking about the tracks I had checked in iTunes on my PC.
It is a little awkward, because indeed, I'll have to start all over again. Any ideas how it happened and how can I prevent it from happening in the future?
Any help would be appreciated.
Kind regards
FJ
CTRL + click on a checkbox that is active / disable State of this box and sets all the other elements in the same point of view to match it. I suspect that you did this in error rather than iTunes acting independently. If you make a playlist of songs you want to hear, or those that you do not have it, it will be easier reset the State checked items to the right if it happens again.
TT2
-
I'm having a problem installing my laptop any idea how should I di it?
I am having a problem installing my printer to laptop can help you how should I do?
Perhaps you could share the brand and model with us.
Have you been on the printer manufacturer driver support site yet?
Or here... http://Windows.Microsoft.com/en-us/Windows-Vista/add-or-remove-a-printer
-
Is it possible to recover a file from the Recycle Bin, once it's been dumped?
If you have a rotating magnetic drive, on third-party utilities such as Data rescue. Note: Data rescue requires another disk on which to save the recovered files.
If you have an SSD, your files are GONE.
--------
If you do not have a backup of confidence, make the conscious decision to NOT to keep all the files on your Mac at all times. It's only a matter of time before a major failure just launch into it. "Any disk can fail at any time."
The solution to this problem is to get an external drive about 2-3 times (or more) the size of what you want to keep and activate the Time Machine (included on your Mac). This drive doesn't have to be fast - USB - 2 will suffice.
After the first backup very long cycle, you will find that Time Machine works quietly in the background at low priority without interrupting your work, and that 'walk' to save files so that when you need a copy, it is here.
-
I am trying to disable my photoshop on the old computer, so I can transfer it to the new computer. Continue to get the 24:24 error code and told to call but can not get a number to work. Any ideas on how to get to TALK to someone?
Oh, for CS2 activation servers have been closed. You must follow the instructions on this link to reinstall CS2:
Error: "Activation Server is not available. CS2, Acrobat 7, pass a hearing 3
-
I have windows xp service pack 3 and internet explorer 7
Hi dollarsfor6,
Welcome to Microsoft Answers Forums.
In most cases if the games are deleted from the computer files will remain on the computer.
I suggest that you are looking for game files in the system32 folder.
Click on Start menu later click on run and type c:\\windows\system32 in the following search of the window for the file of games like free cell. If you get the files in the system32 folder then copy the file to c:\\program files\start menu\ later in the game folder.
If fails it above step, try a system restore to the point when the game was available on the computer.
See the link below to learn how to perform the system restore.
How to restore Windows XP to a previous state
http://support.Microsoft.com/kb/306084
If the fail of steps above, you will need the Windows XP CD to install games on the computer, check out the link for more information below.
How do I add or remove games in Windows XP
http://support.Microsoft.com/kb/307768
Halima S - Microsoft technical support.
Visit our Microsoft answers feedback Forum and let us know what you think.
Maybe you are looking for
-
I installed Windows XP but I can't access the internet. I checked the IPconfig and it is empty. The indicator light on the adapter is on green. Of course, the drivers are missing but whom? original title: IPConfig and lack of internet access
-
It is possble to leave a voicemail customized what callers can hear before leaving a message?
-
HelloW my name is michel , last night, I decided to reinstall my windows 7 like the version I was using started to crash and freez. After downloading and installing windows 7 ultimate 64 bit operating system I couldn't use wifi more. my pc just to sc
-
Can't connect to HP ePrintCenter
I have problems to connect with HP ePrintCenter. I enter the e-mail address I used in the new configuration of the user on the login screen. Login screen does not accept my password. I then click on 'forgot password' and return the email address I us
-
Is there a solution for this error when you try to update to photoshop?Thank you