Delete snapshots by using data from a csv file
I have a csv file that was exported in the form of:
VM
SERV1
serv2
SERV3
(The file name is snaps4.csv)
I want to delete the associated clichés a vm in this file csv; However I can't get anything to work. Is the closest I've come by manually removing the header in the csv file (i.e. VM) then using the get-content command.
$vms = get-Content C:\scripts\Output\snaps.csv
Get-Snapshot - $vms vm | Remove-Snapshot - RemoveChildren-confirm: $false
The above command works, but I have to remove the header first (which I am fine with, if I do this, but I'm trying to automate this process for people of our operations and have a manual step is not ideal).
Someone help me? I know I'm missing just something simple here, but can't understand it.
Have you tried it?
Import-Csv C:\scripts\Output\snaps.csv | %{
Get-Snapshot - vm $_. VM | Remove-Snapshot - RemoveChildren-confirm: $false
}
Tags: VMware
Similar Questions
-
Unable to display data from a csv file data store
Hi all
I'm using ODI 11 g. I'm trying to import metadata from a csv file. To do this, I have created physical and logical diagrams corresponding. Context is global.
Then, I created a model and a data store. Now, after reverse engineering data store, I got the file headers and I changed the data type of columns to my requirement and then tried to view the data in the data store. I am not getting any error, but can't see all the data. I am able to see only the headers.
Even when I run the interface that loads data into a table, its operation without error, but no data entered...
But the data is present in the source file...
Can you please help me how to solve this problem...
Hi Phanikanth,
Thanks for your reply...
I did the same thing that you suggested...
In fact, I'm working on the ODI in UNIX environment. So I went for the record separator on UNIX option in the files of the data store tab and now its works well...
in any case, once again thank you for your response...
Thank you best regards &,.
Vanina
-
Hi, please help me whit this query
Im trying to extrate the data in a file csv and im using the ULT_FILE package
I have this query that read the file and the first field, but if the field has a different length does not work as it shouldFor example if I had this .csv file:
1, book, laptop
2, pen, Eraser
3, notebook, paper
And in the table, I had to insert like this
ID descrption1 description2
laptop 1 book
Eraser pen 2
paper laptop 3
For now, I have this query, which displays only with DBMS:
Declare
-Variables
Cadena VARCHAR2 (32767).
Vfile UTL_FILE. TYPE_DE_FICHIER;
Dato varchar2 (200); -Date
dato1 varchar2 (200);
dato2 varchar2 (200);
Identifier varchar2 (5): = ', '; -Identifier (en)
v_ManejadorFichero UTL_FILE. TYPE_DE_FICHIER; -For exceptions
-Table variables
I_STATUS GL_INTERFACE. % OF STATUS TYPE.
I_LEDGER_ID GL_INTERFACE. TYPE % LEDGER_ID;
I_USER_JE_SOURCE_NAME GL_INTERFACE. TYPE % USER_JE_SOURCE_NAME;
I_ACCOUNTING_DATE GL_INTERFACE. TYPE % ACCOUNTING_DATE;
I_PERIOD_NAME GL_INTERFACE. TYPE % PERIOD_NAME;
I_CURRENCY_CODE GL_INTERFACE. CURRENCY_CODE % TYPE;
I_DATE_CREATED GL_INTERFACE. DATE_CREATED % TYPE;
I_CREATED_BY GL_INTERFACE. CREATED_BY % TYPE;
I_ACTUAL_FLAG GL_INTERFACE. TYPE % ACTUAL_FLAG;
I_CODE_COMBINATION_ID GL_INTERFACE. TYPE % CODE_COMBINATION_ID;
I_ENTERED_DR GL_INTERFACE. TYPE % ENTERED_DR;
I_ENTERED_CR GL_INTERFACE. TYPE % ENTERED_CR;
I_ACCOUNTED_DR GL_INTERFACE. TYPE % ACCOUNTED_DR;
I_ACCOUNTED_CR GL_INTERFACE. TYPE % ACCOUNTED_CR;
I_TRANSACTION_DATE GL_INTERFACE. TRANSACTION_DATE % TYPE;
I_REFERENCE1 GL_INTERFACE. REFERENCE1% TYPE;
I_REFERENCE2 GL_INTERFACE. REFERENCE2% TYPE;
I_REFERENCE3 GL_INTERFACE. REFERENCE3% TYPE;
I_REFERENCE4 GL_INTERFACE. REFERENCE4% TYPE;
I_REFERENCE5 GL_INTERFACE. REFERENCE5% TYPE;
I_REFERENCE10 GL_INTERFACE. REFERENCE10% TYPE;
I_GROUP_ID GL_INTERFACE. GROUP_ID % TYPE;
BEGIN
Vfile: = UTL_FILE. FOPEN ('CAPEX_ENVIO', 'comas.csv', 'R');
loop
UTL_FILE. GET_LINE(Vfile,Cadena,32767);
dato1: = substr (cadena, instr(cadena, identificador,1,1)-1, instr(cadena, identificador,1,1)-1);
dato2: = substr (cadena, instr (cadena, identifier, 1, 1) + 1, instr(cadena, identificador,3,1)-3);
dbms_output.put_line (dato1);
dbms_output.put_line (dato2);
-The evidence
-dbms_output.put_line (cadena);
-dbms_output.put_line (substr (dato, 3, instr(dato, identificador,1,1)-1));
-dbms_output.put_line (substr (dato, instr (dato, identifier, 1, 2) + 1, instr(dato, identificador,1,1)-1));
-dbms_output.put_line (substr (cadena, 1, length (cadena)-1));
end loop;
UTL_FILE. FCLOSE (Vfile);
-----------------------------------------------------------------------------------EXCEPTIONS------------------------------------------------------------------------------------------------------------------------------------------------------------
EXCEPTION
When no_data_found then
dbms_output.put_line ('Todo Correcto');
When utl_file.invalid_path then
UTL_FILE. FCLOSE (V_ManejadorFichero);
RAISE_APPLICATION_ERROR (-20060,'RUTA DEL ARCHIVO NULLIFIED: (');)
WHEN UTL_FILE. INVALID_OPERATION THEN
UTL_FILE. FCLOSE (V_ManejadorFichero);
RAISE_APPLICATION_ERROR ('-20061,'EL ARCHIVO NO PUDO SER ABIERTO ");
WHEN UTL_FILE. INVALID_FILEHANDLE THEN
UTL_FILE. FCLOSE (V_ManejadorFichero);
RAISE_APPLICATION_ERROR (-20062, 'INVALIDO MANAGER');
WHEN UTL_FILE. WRITE_ERROR THEN
UTL_FILE. FCLOSE (V_ManejadorFichero);
RAISE_APPLICATION_ERROR (-20063, 'ESCRITURA ERROR');
WHEN UTL_FILE. INVALID_MODE THEN
UTL_FILE. FCLOSE (V_ManejadorFichero);
RAISE_APPLICATION_ERROR (-20064, 'MODO INVALIDO');
WHEN UTL_FILE. INTERNAL_ERROR THEN
UTL_FILE. FCLOSE (V_ManejadorFichero);
RAISE_APPLICATION_ERROR (-20065, 'ERROR INTERNO');
WHEN UTL_FILE. READ_ERROR THEN
UTL_FILE. FCLOSE (V_ManejadorFichero);
RAISE_APPLICATION_ERROR (-20066, 'LECTURA ERORR');
WHEN UTL_FILE. FILE_OPEN THEN
UTL_FILE. FCLOSE (V_ManejadorFichero);
RAISE_APPLICATION_ERROR ('-20067,'EL ARCHIVO ARE ESTA ABIERTO ");
WHEN UTL_FILE. THEN ACCESS_DENIED
UTL_FILE. FCLOSE (V_ManejadorFichero);
RAISE_APPLICATION_ERROR (-20068, 'REFUSED ACCESS');
WHEN UTL_FILE. DELETE_FAILED THEN
UTL_FILE. FCLOSE (V_ManejadorFichero);
RAISE_APPLICATION_ERROR (-20069, 'OPERACIÓN BORRADO FALLO');
WHEN UTL_FILE. RENAME_FAILED THEN
UTL_FILE. FCLOSE (V_ManejadorFichero);
RAISE_APPLICATION_ERROR (-20070, 'OPERATION SOBREESCRITURA FALLO');
END;
Hello
Try something like this:
POS1: = INSTR (cadena, idntificador, 1, 1);
POS2: = INSTR (cadena, idntificador, 1, 2);ID: = SUBSTR (cadena, 1, pos1 - 1);
description1: = SUBSTR (cadena, pos1 + 1, (pos2 - pos1)-1);
Description2: = SUBSTR (cadena, pos2 + 1);where pos1 and pos2 are numbers.
Rather than use UTL_FILE, consider creating an external table. You won't have to write any PL/SQL, and this means that you won't be tempted to write a bad article of EXCEPTION.
-
Write data from a CSV to table
Hi all
I have a CSV (Comma Separated Values) file and I want to write its data to the table.
How can I get data from a CSV file.Knani suggested, you can use external Tables or Sql Loader
You can check this link for example on Sql Loader http://surachartopun.com/2007/10/example-sql-loader-some-data-into.html -
While closing a link to expedia.ca a message come to say: the page you requested was created using data from the form. This page is no longer available. If you resend the data, any action that has been specified by the form will be repeated. You want to resubmit the data? When I click Yes or no, nothing happens except that the message just reappears. I can't get rid of it so I can't do anything else on my phone, except to answer a call if someone calls me. How can I get rid of this message from my phone? I tried to turn it works... even by leaving off the coast for 5 minutes before turning turn it back on. I can't even check my OS because I do not what anyone on my phone. I hope someone can help me with this.
Have you tried a battery pull? This should fix a problem as you described.
With your phone, remove the battery, then replace a minute later. This will do all sorts of wonderful things to your phone for free unclaimed memory, delete no cited source points and make your phone run smoothly.
Try it and let us know if it does the trick.
-
Load the data from a text file into a table using pl/sql
Hi Experts,
I want to load the data from a text file (sample1.txt) to a table using pl/sql
I used the pl/sql code below
***********************************
declare
f utl_file.file_type;
s varchar2 (200);
c number: = 0;
Start
f: = utl_file.fopen('TRY','sample1.txt','R');
loop
UTL_FILE.get_line (f, s);
insert into sampletable (a, b, c) values (s, s, s);
c: = c + 1;
end loop;
exception
When NO_DATA_FOUND then
UTL_FILE.fclose (f);
dbms_output.put_line('No. deles de lignes insérées: ' || c);
end;
***************************************
and my sample1.txt file looks like
***************************************
1
2
3
***************************************
Gets the data inserted, with way below
Select * from sampletable;
A, B AND C
1-1-1
2-2-2
3 3 3
I want that data to get inserted as
A, B AND C
1 2 3
The text file I have is to have three lines, and the first value of each line should go to each column
Help, please...
Thank youdeclare f utl_file.file_type; s1 varchar2(200); s2 varchar2(200); s3 varchar2(200); c number := 0; begin f := utl_file.fopen('TRY','sample1.txt','R'); utl_file.get_line(f,s1); utl_file.get_line(f,s2); utl_file.get_line(f,s3); insert into sampletable (a,b,c) values (s1,s2,s3); c := c + 1; utl_file.fclose(f); exception when NO_DATA_FOUND then if utl_file.is_open(f) then utl_file.fclose(f); ens if; dbms_output.put_line('No. of rows inserted : ' || c); end;
SY.
-
Received the error when transferring data from the database file
Hello...
I have my using SOA 10.1.3.1.0. I am trying to transfer the data from the CSV of the oracle database.
The settings of connection in file xml oc4j DBA adapter file in the path C:\product\10.1.3.1\OracleAS_1\j2ee\oc4j_soa\application-deployments\default\DbAdapter is shown below.
< location connector-factory = name of the connector "ist/DB/DBConnection1" = "Adapter database" >
< config-property name = "xADataSourceName" value = "jdbc/DBConnection1DataSource" / >
< config-property name = "dataSourceName" value = "loc/DBConnection1DataSource" / >
< config-property name = "platformClassName" value="oracle.toplink.platform.database.Oracle9Platform"/ >
< config-property name = "usesNativeSequencing" value = "true" / >
< config-property name = "sequencePreallocationSize" value = "50" / >
< config-property name = "defaultNChar" value = "false" / >
< config-property name = "usesBatchWriting" value = "true" / >
< connection pooling using 'none' = >
< / connection pooling >
< use security-config 'none' = >
< / security-config >
< / connector-factory >
I get the following error:
< name of part = "summary" >
< Summary >
file:/C:/product/10.1.3.1/OracleAS_1/BPEL/domains/default/tmp/.bpel_FileToDb_v1.0_188277739ed1e0b720c1fefd0275d1c0.tmp/FileToAdapterService.WSDL [FileToAdapterService_ptt::insert (FiletodbCollection)] - SISM JCA Execute of operation "insert" has no reason to: could not create/access the TopLink Session.
This session is used to connect to the data store. Caused by: loc/DBConnection1DataSource not found
; nested exception is:
ORABPEL-11622
Could not create/access the TopLink Session.
This session is used to connect to the data store. [Caused by: loc/DBConnection1DataSource not found]
See the first exception for the specific exception. You may need to configure the connection settings in the deployment descriptor (i.e. $J2EE_HOME/application-deployments/default/DbAdapter/oc4j-ra.xml), and then restart the server. Caused by the Exception TOPLINK-7060 (Oracle TopLink - 10g Release 3 (10.1.3.1.0) (Build 061004)): oracle.toplink.exceptions.ValidationException
Description of the exception: could not acquire data source loc/DBConnection1DataSource
Inner exception: javax.naming.NameNotFoundException: loc/DBConnection1DataSource not found.
< / Summary >
< / part >
What is the error in the loc/DBConnection1DataSource line? Guys thank you in advance...
Thank you...
Published by: userus007 on January 2, 2010 17:16
Published by: userus007 on January 2, 2010 17:18Visit similar thread oc4j - RA.xml and data - sources.xml
-
Writing data in the CSV file?
I tried, but in vain, to write data in the CSV file, with the column headers of the file labeled appropriately to each channel as we do in LabView (see attached CSV). I know that developers should do this same in .net. Can anyone provide a snippet of code to help me get started? In addition, maybe there is a completely different way to do the same thing instead of writing directly to the CSV file? (In fact, I really need to fill a table with data and who join the CSV every seconds of couple). I have the tables already coded for each channel, but I'm still stuck on how to get it in the CSV file. I'm coding in VB.net using Visual Studio 2012, Measurement Studio 2013 Standard. Any help would be greatly appreciated. Thank you.
a csv file is nothing more than a text file
There are many examples on how to write a text using .NET file
-
Update of field Notes from a csv file
Hello
I want to update the Notes field for all of the virtual machines in my environment from a .csv file. To do this, I did and the export of my environment in a file .csv using this command:
Get - VM | Select Name, Notes | Export-Csv-path "c:\output\notes.csv" - NoTypeInformation
I now have a list of all virtual machines and their existing Notes. I manually changed the notes fields keeping the existing descriptions and adding, for all the virtual machines that had no notes. I would now like to merge the changes into vCenter and to crush any descriptions in vCenter but my code is any error on:
Import-Csv "c:\output\notes.csv" | % {Set - VM $_.} VMName-note $_. {Note - confirm: $false}
Any ideas?
Well, the field of your CSV is 'Name', not "VMName".
So, try:
Import-Csv "c:\output\notes.csv" | % {Get - VM $_.} Name | Set-VM-note $_. {Note - confirm: $false}
-
Configure vswitches from a .csv file - problem
I have a script that works very well for the installation of my virtual past by using the updatevirtualswitch method. (Thanks to LucD, see here: ) http://communities.VMware.com/message/1556669#1556669 )
I now want to go further and to feed my script with variables from a .csv file.
It works fine for all, with the exception of the definition of vmnic. Description of the problem:
Excerpt from my .csv file:
lannics; dmznic1; dmznic2; dmznic3; storagenics; vmotionnics;
@("vmnic0"); @("vmnic1", "vmnic2");
Then import the settings from the csv file, example:
$lannics = $parameterfile.dmznic1
Now, if I check what's in $dmznic1, I have the good: @("vmnic1", "vmnic2")
But it seems to be a string, not a true table. Therefore, I can not pass it to my updatevirtualswitch function:
function standardvswitch {}
Param ($esx, $vs, [string []] $dmznic1)
....
$ns. UpdateVirtualSwitch ($vs, $vsSpec)
}
So the question is: how could I get my .csv file information, so that it can be used for a definition of vmnic compatible with the UpdateVirtualSwitch method?
Thanks for your help or ideas!
I've done a few tests more and saw that my previous solution does not work. "But one that follows). I'll try to explain how it works. In the .csv file, a semicolon is used as a field separator. This means that you can use a comma in a field to separate the members of the group. The Import-CSV cmdlet reads the .csv file and - separator "," parameter instructs the cmdlet that a semicolon is the field delimiter. The output of the Import-CSV cmdlet is piped in a ForEach-Object cmdlet. In the scriptblock ForEach-Object according to the value of the dmznic1 property string is shared by the comma, so each string before, between and after the comma will become a member of separate table. This table is assigned to the dmznic1 property. Loop loop through all the members of the Group and displays them on separate lines. So you can see that it is really a picture.
Import-CSV -Path LanNics.CSV -Delimiter ";" | ` ForEach-Object { $_.dmznic1 = ($_.dmznic1).split(",") for ($i=0;$i -lt $_.dmznic1.length; $i++) { Write-Output $_.dmznic1[$i] } }
See the attached screenshot for output.
I think that this solution is more beautiful that create a different column for each vmnic because in my solution you don't have to know in advance how many cards you have.
Post edited by: RvdNieuwendijk
-
How to store the captured data in the csv file
Here's the sceanario
I was able to capture data from the oracle forms and store it in variables.
now, I want to store the same data in the csv file and save this csv file.
quick reply is appreciated.Ok. This is what my, admittedly simple, code performs above: var_orderid col1 and col2 in var_quantity.
See you soon,.
Jamie -
How to ignore the details of footer when loading data from a .txt file
Hello experts,
I import data from a txt file in my database. I jumped my header using SKIP information, but how can I ignore my footer details.
Thank youAnswer on your other thread:
-
Extract data from an xml file takes almost an hour to 2.5 M data.
Hello
Any help would be much appreciated. Extract data from an xml file takes almost an hour to 2.5 M. data is there a solution to this.
WITH t AS
(SELECT XMLTYPE (response) pass FROM dual
)
SELECT
b.entity_id,
c.INSTANCE_ID,
d.attribute_id,
d.DATA_TYPE,
d.ATTRIBUTE_VALUE,
d.outcome_style
T,.
XMLTABLE (XMLNamespaces ("http://schemas.xmlsoap.org/soap/envelope/" AS "SOAP-ENV"
'http://oracle.com/determinations/server/10.3/rulebase/assess/types' AS 'type')
, ' SOAP - ENV:Envelope / SOAP - ENV:Body / typ: assess-response/typ: global instance / typ:entity'
PASSAGE t.col
Path of COLUMNS entity_id VARCHAR2 (256) "@id".
path XMLTYPE res_tmp2 'typ:instance') b
xmltable (XMLNamespaces ("http://schemas.xmlsoap.org/soap/envelope/" AS "SOAP-ENV"
'http://oracle.com/determinations/server/10.3/rulebase/assess/types' AS 'type')
, "typ:instance".
PASSAGE b.res_tmp2
Path of COLUMNS instance_id VARCHAR2 (256) "@id".
path XMLTYPE res_tmp3 'typ:attribute') c
xmltable (XMLNamespaces ("http://schemas.xmlsoap.org/soap/envelope/" AS "SOAP-ENV"
'http://oracle.com/determinations/server/10.3/rulebase/assess/types' AS 'type')
, "typ:attribute".
PASSAGE c.res_tmp3
Path of VARCHAR2 (256) COLUMNS attribute_id '@id '.
, data_type VARCHAR2 (256) path '@type '.
, attribute_value VARCHAR2 (256) path '.'
path VARCHAR2 (256) outcome_style '@inferred') d;
Thank you
MhandOK, in this case the best option is to store the answer in a binary table of XMLType (may be a temporary table if you want to) and run the query from there:
CREATE TABLE tmp_xml OF XMLType XMLType STORE AS SECUREFILE BINARY XML -- default storage in your version ;
INSERT INTO tmp_xml VALUES(XMLType(response));
SELECT b.entity_id, c.instance_id, d.attribute_id, d.data_type, d.attribute_value, d.outcome_style FROM tmp_xml t, XMLTABLE( XMLNamespaces('http://schemas.xmlsoap.org/soap/envelope/' AS "SOAP-ENV" , 'http://oracle.com/determinations/server/10.3/rulebase/assess/types' AS "typ") , 'SOAP-ENV:Envelope/SOAP-ENV:Body/typ:assess-response/typ:global-instance/typ:entity' PASSING t.object_value COLUMNS ...
-
Calibration of thermocouples in the DAQ Assistant, using data from spreadsheet?
Hi all
For my first application LabVIEW, I'm looking to automate the calibration of thermocouples by measuring their response at different temperatures in a dry well Sizer. I get temperatures of thermocouples six by SCXI 1303/1102/1600 and have six channels put in place in one of my subVIs in the DAQ assistant.
I compare these values to temperature calibrator that I am acquiring by VISA series in an other Subvi. All these values are written in a .csv file.
Can I import these data into the DAQ Assistant to use for calibration? Is there a simpler way to associate with the channel calibration data? Currently, I could manually copy - paste the cells on the worksheet in the calibration sheet, but that seems just silly.
If there is everything that I could provide to help solve the problem, let me know!
Thank you!
Hi Zoysiamo,
It is possible to automate the calibration screws DAQmx at a lower level, in particular the DAQmx channel property node. Using you can specify advance nationwide and the values on the scale for your channel. I recommend you take a look at this example of the community. The property node configuration will be similar to, as illustrated below:
-
Using data from the control table
Hello
I would like to use the data entered in a table to automate volume/sequence of airflow for a test Chamber. As shown in the screenshot of control table, the first column indicates the number of iterations by elements of array in a series of tests and the second data column specifies the length of each line sequence. Entries in the other columns are specific to different valves and specify values set required in the flow meter.
I guess my question is how can I index/assign each column of the table such that the data to exploit the respective valves are obtained in subsequent iterations all acquire simultaneously with data from other components in the order? While I recognize that the solution may be very simple, I searched on through various examples and messages on the tables and the tables without knocking on a solution. The attached .vi allows me to be a part of the series of tests.
Best regards
Callisto
Hi Callisto,
If I understand your question then the solution is actually quite simple. The important point to keep in min is the fact that the Table control can actually be treated as an array of string. You can then use all the traditional table manipulation tools and techniques to manipulate your data as you wish. For example, use the Array Index function to retrieve specific columns and then if you want to spend the individual elements in a column in a loop, wire the table until the loop and ensure that indexing is enabled. If you then want to use these data elements to control your test application, you can convert a portion of the resulting string in more useful to digital.
All these concepts are illustrated in the attached VI. I hope this helps, but let me know if you have any other questions.
Best regards
Christian Hartshorne
NIUK
Maybe you are looking for
-
I can't believe I allowed myself to be in a situation sgain My mac is dead and it does not load, the charger LED flashes and I just want to know what to do. In doing so, it was not while she had a battery life, she would charge very well. But now tha
-
is it safe to use a site of grey padlock for purchase with credit card?
I noticed that the lock is sometimes gray on firefox, when green on chrome?
-
How to make the homepage to appear when opening new tab
Under Firefox 40.x whenever I opened a new tab, my home page appeared. When I upgraded to 41.0, opening a new tab displays the suggested sites. How do I have my home page appear whenever I open a new tab?
-
I accidentally clicked on 'always allow a remote content' on a notification from paypal, but now all my emails from paypal are listed with the same name, even if they all actually different. The content of the email is the same thank godness, but thi
-
Re: Touchpad stopped working on my Satellite L350-171
Are my touchpad stopped working and the 2 buttons below. I have been using only a usb mouse, but I want to free up space, are there solutions please.