Tools.syncTime query parameter using PowerCLI
Hey,.
I have a vCenter 5.5 full of virtual machines that I need to test compliance with KB1189 - disabling time synchronization
Using Get-AdvancedSetting I can test and get results for all parameters except 'tools.syncTime '. Is there a way to query this setting?
Thank you
There is indeed no need to perform a Get-view extra, you can do
Get - VM | Select Name,@{N='TimeSync'; E={$_. ExtensionData.Config.Tools.syncTimeWithHost}}
Tags: VMware
Similar Questions
-
Table query result using prepared as a parameter in the prepared statement later
Hi all
Very new to PHP. A series of 3 prepared statements (see code below), I'm trying to sink. This page is triggered from a link on a page that lists the individual and all candidates which works well. Prepared statement 1 works and displays the data in the columns line wanted specific, bottom access so I would call it record and areas, but I think it is called line and columns here. Prepared Statement 2 which hands on a table of cross references (we have a many-to-many relationship between candidates and positions, therefore for the table of cross references) works and I can say the $selected_positions charges table, because I can see position_id data in the < body > of the file using this:
<? PHP
foreach ($selected_positions as $item) {}
echo $item. "< br / > ';
}
? >
Can't take this $selected_positions table and use it as parameter in the prepared statement 3, at least not how I try to do. So obviously he manages not prepared statement 3 no way is a table that I called $the_positions which is supposed to contain the ID of the post, position of securities and to position the position_id numbers that are in the array $selected_positions. I can say that 3 of prepared statement is a failure because there is no indication in this table that is in the < body > of the file:
< table class = "stripes table" >
< b >
Identification of the Position < /th > < th >
< /Th > < th > post number
Title < th > < /th >
< /tr >
<? PHP while ($stmt-> fetch()) {? >}
< b >
< td > <? = $position_id;? > < table >
< td > <? = $position_number;? > < table >
< td > <? = $title;? > < table >
< /tr >
<? PHP}? >
< /table >
Here is the PHP script:
<? PHP
require_once '... /includes/session_timeout_db.php';
? >
<? PHP
require_once '... /includes/Connection.php';
initialize the flag
$OK = false;
$conn = dbConnect ('read');
initialize statement
$stmt = $conn-> stmt_init();
If (isset($_GET['candidate_id'])) {}
$sql = ' SELECT candidate_id, last_name, first_name, society, mas_number, last_modified, notes
CANDIDATES WHERE candidate_id =?'; }
If ($stmt-> {prepared ($sql))}
bind the query parameter
$stmt-> bind_param ('i', $_GET ['candidate_id']);
run the query and fetch the result
$OK = $stmt-> execute();
bind the results to variables
$stmt-> bind_result ($candidate_id, $last_name, $first_name, $company, $mas_number, $last_modified, $notes);
$stmt-> fetch();
free resources for the second query database
$stmt-> free_result();
}
get the associated positions candidate
$sql = 'SELECT position_id FROM pos2cands WHERE candidate_id =?';
If ($stmt-> {prepared ($sql))}
bind the query parameter
$stmt-> bind_param ('i', $_GET ['candidate_id']);
run the query and fetch the result
$OK = $stmt-> execute();
$stmt-> bind_result ($position_id);
Browse the results to store in a table
$selected_positions = [];
While ($stmt-> fetch() {)}
[] $selected_positions = $position_id;
}
}
find data on the position of the table
$sql = ' SELECT position_id, position_number, title
FROM place WHERE position_id =?';
If ($stmt-> {prepared ($sql))}
bind the query parameter
$stmt-> bind_param ('i', $_GET [$position_id]);
run the query and fetch the result
$OK = $stmt-> execute();
bind the results to variables
$stmt-> bind_result ($position_id, $position_number, $title);
Browse the results to store in a table
$the_positions = [];
While ($stmt-> fetch() {)}
[] $the_positions = $position_id;
}
}
Get the error message if the request fails
If (isset ($stmt) & &! $OK) {}
$error = $stmt-> error;
}
If (! $stmt) {}
$error = $conn-> error;
} else {}
$numRows = $stmt-> num_rows;
}
? >
Thank you in advancel
You want to use the value of request 1 or query2 as a parameter in the query 3, right? Rather than build a table, you can simply use the value returned by each line that the query returns. I use PDO, no MySQLi, so I can't knock out quickly the MySQLi example for you.
While ($result = $sql-> fetch (PDP::FETCH_ASSOC)) {}
$field = $result ['domain'];Now we can use the value of $field as parameter for the next query.
The brace that closes the while loop is placed after the last query
so no need to fill an array with values
}
Your approach is doable with a few changes to the way in which you go through the table, but it is unnecessarily complicated.
You might be able to use a single query to get all the data if you use left joins. With this approach, you start with the table that SHOULD return a result or which requires no dependencies to other tables. The structure is like this:
SELECT field1, Field2, field3 FROM (SELECT * FROM table1 WHERE field3 = param1) has
LEFT JOIN (SELECT * FROM table2 WHERE A.field4 = table2.field4) B
LEFT JOIN table3 ON table3.field5 = B.field5 ORDER BY Field1
A and B above are aliases for subsets of the table. You can image a (tacit) sign = equal A
-
Using the QUERY parameter in exp/expdp
Hi, I've faced a nite last question.
IM currently using Oracle 10 g (10.2.0.4) OS - MS Windows Server 2003
I want a dump of tables to export multiple schemas. say (acb.m1, pqr.b2, xyz.b1)
Each table has a minimum lines of 2,000,000,
And I want to just the initials 10 rows in each table of export
Is it possible that I can do this...
Please answer.
Thanks in advanceExport tables in multiple schemas is not supported in Data Pump until 11.1.0.7. So if you're on 10g, you will need to run multiple commands expdp. For only 10 lines of each table, use the query parameter
Query = "where rownum"<>
This will apply to all the tables you export.
I hope this helps.
Dean
Published by: Dean WINS January 30, 2012 08:42
-
check if there is a service on a vmguest using powercli
Is there a way I can check if there is a service on a vmguest, using powercli?
I found several ways to do it using powershell commands, but I want to know if I can do it using powercli.
Thank you
If you have installed on the virtual machines VMware tools, you can use the Invoke-VMScript cmdlet to run a script PowerShell inside the guest OS.
$vm = get-VM-name MyVM
$cmd = "get-Service WinRM name.
Invoke-VMScript - VM $vm - $cmd ScriptText
According to the account under which you run the script, you may need to use the GuestCredential parameter
-
Is it possible to run "shrink" using PowerCLI VMtools
Hi all
Is it possible to run the VMware Tools "shrink" using PowerCLI function? WMI is not desirable since it would need to open ports in the firewall that are not open at the moment, I'm looking for a solution where it could be done directly from vCenter Server as upgrade VMware Tools to remove CD/DVD.
I gave a "base" intro on _task methods using in How to display and monitor running tasks?. "
Taking into account the Yavor comments that the skeleton code becomes:
...... $taskMoRef = $esx.ExitMaintenanceMode_Task(0) $task = Get-View $taskMoRef while ($task.Info.State -eq "running" -or $task.Info.State -eq "queued") { sleep 2 $task.UpdateViewData("Info.State") } # Check return code of the _task in $task.Info.result if($task.Info.result -ne "success"){ .... } ...
For this task (ShrinkVirtualDisk_Task), you must make some preparations before the actual call.
The _this parameter you indicates which object, you can call the method. In this method, it is the VirtualDiskManager.
You can get to the the ServiceInstance VirtualDiskManager.
$vdiskMgr = Get-View -Id (Get-View ServiceInstance).content.virtualDiskManager
Then, you need to set the parameters for the method.
$name = "[datastore1] PC1/PC1.vmdk" $dcMoref = (Get-Datacenter "dc1" | Get-View).MoRef $copy = $false
Now you have all the elements to make the call
$taskMoRef = $vdiskMgr.ShrinkVirtualDisk_Task($name,$dcMoRef,$copy)
Bring together
$vdiskMgr = Get-View -Id (Get-View ServiceInstance).content.virtualDiskManager $name = "[datastore1] PC1/PC1.vmdk" $dcMoref = (Get-Datacenter "dc1" | Get-View).MoRef $copy = $false $taskMoRef = $vdiskMgr.ShrinkVirtualDisk_Task($name,$dcMoRef,$copy) $task = Get-View $taskMoRef while ($task.Info.State -eq "running" -or $task.Info.State -eq "queued") { sleep 2 $task.UpdateViewData("Info.State") } # Check return code of the _task in $task.Info.result if($task.Info.result -ne "success"){ .... }
Hope this has helped.
-
How to wear the formhandler query parameter in jsp
I know that its very stupid question, but I don't get a query parameter. I don't know what mistake I make.
Here is my code snippet:
I created a formhandler
LoginFormHandler.java
public boolean handleLogin (request, response DynamoHttpServletResponse DynamoHttpServletRequest)
throws IOException, ServletException {}
Here the value of the user ID is available I checked using DD
request.setParameter ("userId", username);
handleFlag = checkFormRedirect (getCreateSuccessURL (), getCreateFailureURL(), request, response);
in CreateSuccessURL it redirects to LoginSuccess.jsp
LoginSuccess.jsp
< %
DynamoHttpServletRequest drequest = ServletUtil.getDynamoRequest (request);
% >
value: < %=drequest.getParameter("userId") % >
Once that LoginSuccess.jsp the display is showing the value null of userId
Please let me know how to wear the setting the Manager of jsp.
Application settings will be lost in the success page because the formhandler send a redirect to the success page.
It will be new demand for the success page.
As suggested, or you will need to put this in formhandler, or cookie or in the url
Peace
Shaik
-
Get a user/group, details of role using Powercli
Hi all
I wrote the script to extract the user role by using Powercli below information and got the details.
$Excel = new-Object - ComObject Excel.Application
$Excel.visible = $True
$Excel = $Excel.Workbooks.Add)
$Sheet = $Excel.Worksheets.Item (1)
$Sheet.Activate () | Out-Null
$Sheet.Name = 'vCenter roles. "
$Sheet.Cells.Item (1,1) = 'name '.
$Sheet.Cells.Item (1,2) = 'Role '.
$Sheet.Cells.Item (1,3) = "entity".
$Sheet.Cells.Item (1.4) = 'entity Type.
$Sheet.Cells.Item (1.5) = 'vCenter.
$intRow = 2
$WorkBook = $Sheet.UsedRange
$WorkBook.Interior.ColorIndex = 19
$WorkBook.Font.ColorIndex = 11
$WorkBook.Font.Bold = $True
$gps = get-vipermission
{foreach ($gp to $gps)
$vc = $gp.uid.split(':@') [1]
$Sheet.Cells.Item ($intRow, 1) = $gp.principal
$Sheet.Cells.Item ($intRow, 2) = $gp. Role
$Sheet.Cells.Item ($intRow, 3) = $gp.entity.Name
$Sheet.Cells.Item ($intRow, 4) = $gp.entityid.split('-') [0]
$Sheet.Cells.Item ($intRow, 5) = $vc
$intRow = $intRow + 1
}
$WorkBook.EntireColumn.AutoFit)
In addition, I am trying to expand the list of privileges using the script below.
$gvips = get-vipermission | Role of group | Select name
{foreach ($gvip to $gvips)
Get-ferrule-name $gvip.name | Select Name, PrivilegeList
}
I can find out the name and the list of privileges, but not completely due to the long list of Privlieges for certain roles. I'm out like {xxx.xxxxxxxxxxxxxxxx...}
As it then not be able to see full privileges.
If single role that I want to see, then I can run the command get-ferrule-name admin | Select - expandproperty PrivilegeList
Above command will list the perfect performance. But this command cannot be used for loop with the parameter 'Name '.
Can anyone suggest me how to get result with all the details.
Is it possible I can get 2 out of Scripts in a spreadsheet or HTML with SameFormat file.
Thanks in advance.
Try like this
$reportName = "C:\Report.xlsx".
Get-VIPermission |
Select Principal,Role,@{n='Entity'; E={$_. Type of Entity.Name}},@{N='Entity'; E={$_. "EntityId.Split('-') [0]}}, @{N = 'vCenter';" E={$_. {{Uid.Split (' @: ') [1]}} |
Export-Xlsx-path $reportName - WorksheetName permissions
Get-ferrule.
Select Name,@{N='PrivilegeList'; E = {[string]: join (",", $_.)} PrivilegeList)}} |
Export-Xlsx-path $reportName - AppendWorksheet - WorksheetName roles - end SheetPosition
-
Automatic creation of pools (linked Clone) using powerCLI
Hello
I am using powerCLI to create automatic pool (linked clone). I came across the following cmdlet in theVMware powershell integration white paper:
Get-ViewVC - serverName < IP/domain FULL name >. Add-AutomaticLinkedClonePool-pool_id
TestAutomaticLinkedClonePool - namePrefix pad - parentVMPath / < Center > < parentVM > /vm/
-parentSnapshotPath / < cliché - > vmFolderPath / < Center > /vm - resourcePoolPath
/ /host/ < Center > < ESX > / resources - dataStoreSpecs / < Center > /host/ < ESX > / < datastore >
-composer_ad_id < id ad composer >
Now, I want to help discover (with an example will be very useful) how you specify and how find you each of the following (as what do I put after each other):
-parentVMPath
-parentSnapshotPath
-vmFolderPath
-resourcePoolPath
-dataStoreSpecs
-composer_ad_id
Please give an example of each if possible.
Thank you!
OK, I'll give it a try.
The parentVMPath parameter expects the path to the virtual machine that you want to spawn the pool (obviously).
Such a path looks like this: / MyDC/vm/MyVM
Where MyDC is the datacentername, the vm folder is hidden folder that contains the hierarchy of models and virtual computers, and finally the name of the virtual machine itself.
If your master VM is deeper in the structure of folders, just add the folders in the path.
Ex: / MyDC/vm/Folder1/Folder2/MyVM
The parentSnapshotPath is similar to the previous setting, but obviously needs to point to the snapshot pool should clone.
Alan has a nice feature to recover the snapshotpath Updateand re-view pools calm.
The vmFolderPath is where the virtual machines that are created for the pool to be stored.
Similar to the previous settings, but now for the record once again.
Ex: / MyDC/vm/PoolFolder
resourcePoolPath must point to a resourcepool.
Such a path will look something like this: / MyDC/host/MyCluster/Resources/MyResourcePool
Note that host and resources are again hidden folders!
datastoreSpecs: this is not the most obvious.
He wants the full path to a data store in a cluster that is specified by a resource pool.
See the function VVGetDatastorePath to determine the paths to vSphere Datastore objects
The composer_ad_id wants that the ID of the AD domain, in which the composer is a member server.
You can get this through to: ComposerDomain-Get | select composer_ad_id
As side note, take a look at the Integration of PowerShell with view 5.0 white paper. Perhaps, it is not intended for the latest version of the view
but he explains some settings a lot better than I could
-
Browse data using PowerCLI warehouses
We have a large installation of VMware 5.0 in several data centers, clusters and hosts. If we remove a VM from the inventory without noticing the datastore he resided on and the need to add it to the inventory, you must go through each data store and browse through each one of them.
Is there an easier way to search for a virtual machine using PowerCLI or another method?
Hello, AliSarreshteh-
Yes, nearby. Like writing your piece of code get all files with "DES084" at the end of the file name. Since you want to find all files with "DES084" anywhere in the name, I guess (not only at the end of the file name), you must add an another wildcard to the value of the - include parameter in the statement "dir". As:
...## search for everything that has "DES084" in the namedir -Recurse -Path vmstores:\ -Include *DES084* | select Name,DatastoreFullPath,LastWriteTime | Export-Csv -NoTypeInformation -UseCulture -Path D:\MyVMDKInfo.csv
What to do better for you?
-
Inventory of VC using powercli
Hi all
I'm looking for a script using powercli for several stocks of VCenterservers something like Vcenter name, host name, name of vm, the VM OS. Notes VM, information data store and vm tools release in excel or csv format
Note: for multiple Vcenters
You can check the PowerCLI version you are running? You can do it with the Get-PowerCLIVersion cmdlet. The latest version is: "VMware vSphere PowerCLI 5.1 Release 2 build 1012425. If you are using an earlier version, then please install the latest version. You can download this version of http://www.vmware.com/go/powercli.
The
Set-PowerCLIConfiguration -DefaultVIServerMode Multiple -Scope User -Confirm:$false
command should work in the latest version of PowerCLI.
Certificate warnings can be removed with the following command:
Set-PowerCLIConfiguration -InvalidCertificateAction Ignore -Scope User -Confirm:$false
To make the script more quickly, I did a new version using the cmdlet Get-View . This new version is about three times faster than the former.
& { foreach ($vCenterServer in $DefaultVIServers) { Get-View -Server $vCenterServer -ViewType VirtualMachine -Filter @{"Config.Template"="False"} -Property Name, Runtime.Host, Guest.GuestFullName, Config.Annotation, Datastore, Config.Tools.ToolsVersion | Select-Object -Property @{N="vCenter";E={$vCenterServer.Name}}, @{N="VMHost";E={(Get-View -Id $_.Runtime.Host -Property Name).Name}}, @{N="VM";E={$_.Name}}, @{N="Guest OS";E={$_.Guest.GuestFullName}}, @{N="Notes";E={$_.Config.Annotation}}, @{N="Datastores";E={[string]::Join(',',(Get-View -Id $_.Datastore).Name)}}, @{N="VMware Tools version";E={$_.Config.Tools.ToolsVersion}} } } | Export-Csv -Path VMsInfo.csv -NoTypeInformation -UseCulture
-
The query options using command exp
Hello
I'm trying to export a data tables under the following conditions, but it fails. How to export data from tables with the sub condition? The data type of the column is ID NOT NULL VARCHAR2 (80)
test/test exp = EMP query = tables------"' where id like ' % 00% ' \ ' log = emp.log file = emp.dmp"
Export: Release 11.2.0.1.0 - Production Fri Nov 21 21:54:12 2013
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With partitioning, OLAP, Data Mining and Real Application Testing options
Export in US7ASCII and AL16UTF16 NCHAR character set
Server uses WE8MSWIN1252 (possible character set conversion) character set
About to export specified tables by conventional means...
. . export the table EMP
EXP-00056: ORACLE 911 error encountered
ORA-00911: invalid character
Export completed successfully with warnings.
The same conditions as the table below mentioned number of records.
SQL > select count (*) from emp where id like ' % 00% ';
COUNT (*)
----------
2701
Kind regards
007
PL note that first export is desupported in 11 GR 2 - see the first section of the Note to the Original export
You should use expdp with the QUERY parameter - Data Pump Export
HTH
Srini -
Get the gateway of a computer virtual using Powercli
Hi all
Anyone know if it is possible to use PowerCli to get a virtual computer gateway?
I've looked everywhere and I just find the function to make the set.
Thank you for your help
This information is available from the guest OS only when you have VMware Tools installed in the comments.
Then you could do
Get-VM MyVM | Get-VMGuestNetworkInterface -GuestUser MyAccount -GuestPassword MyPassword | Select VM,NetworkAdapter,DefaultGateway
-
upgrade to esxi 4.1 to esxi 4.1 update 1 using powercli
How to install the update to esxi 4.1 using powercli (powershell?)
Hello
The ESXi upgrade could be a problem if the patch file is too large, because there is not enough space in the tmp drive. If you could download the patch on a data store of the host and after this call to the Install-VMHostPatch cmdlet with the HostPath parameter. See the third example here:
http://www.VMware.com/support/developer/PowerCLI/PowerCLI41U1/HTML/install-VMHostPatch.html
Vitali
Team PowerCLI
-
How to use PowerCLI to activate the function VM NPIV and config setting?
Hi all:
I'm having a problem on PowerCLI.
Can I use PowerCLI for NPIV to the VM config?
OK, I see. This is possible with the operator "set".
Note that the script must convert the hexadecimal number WWN in a 64-bit decimal number.
$vmName = "MyVM" $nodeWWN = "28:2b:00:0c:29:00:00:07" $portWWN = "28:2b:00:0c:29:00:00:08" # Convert WWN string to 64-bit number $nodeWWN64 = [int64]("0x" + $nodeWWN.Replace(":","")) $portWWN64 = [int64]("0x" + $portWWN.Replace(":","")) # Activate NPIV $spec = New-Object VMware.Vim.VirtualMachineConfigSpec $spec.NpivDesiredNodeWwns = 0 $spec.NpivDesiredPortWwns = 0 $spec.NpivTemporaryDisabled = $false $spec.NpivWorldWideNameOp = "set" $spec.NpivPortWorldWideName = @($portWWN64) $spec.NpivNodeWorldWideName = @($nodeWWN64) $vm = Get-VM -Name $vmName $vm.ExtensionData.ReconfigVM($spec)
You can use the cmdlet New - hard drive to attach a disc RDM. Make sure to specify a type of "gross" on the parameter - DiskType.
You ID LUN with the parameter - DeviceName.
____________
Blog: LucD notes
Twitter: lucd22
-
'Function SQL Query return' using with Flash graphics
I created a pl/sql function that returns a SQL query in a varchar2 of this form:
Select the null link
-value > < x value
< value y of Series1 > series 1 label
< value Series2 y > 2 series label
< value of y Series3 > series 3 Label
...
...
from tablea a
Join tableb b
On a.col = b.col
order of < x value >
If I call the function of a graphic Flash box series SQL with the Type of Source query "SQL query" value that returns the function like this:
return functionname (to_date ('30-sep-2010, ' mon-dd-yyyy ""))
It parses correctly and the page is saved; However, when I run the page I get no output - error messages or another indication of a problem.
Now, if I call the function in a SQL client, capture the result of the query SQL using the dbms_output and paste that into the box graphic Flash series SQL - change the Source Type of SQL query query - and save the page it works fine when I run it and returns a chart series flash.
Can anyone suggest either;
1. what I might have missed or done wrong?
2. a way to effectively diagnose the problem...
I tried to use the debugger Apex - what is very nice, indeed - but it provides no information on what might be my problem. I tried to write my own my function debug messages using the apex_debug_message package - nothing...
Thank you
EricHi Eric,.
Try to pull the source like this:
begin return functionname(to_date('30-sep-2010', 'dd-mon-yyyy')); end;
This works very well for me, and if I take the begin-end and the final semicolon from the return statement I get the same behavior as you.
He doesn't mention in aid of the source (only during the wizard if) this source type must be expressed in this way, but I agree, it would be useful that the tool would validate to this format meets it "Query SQL that returns the function" or give some sort of indication of the sentence. In any case, this should help you will again.
Hope this helps,
JohnIf you find this information useful, please do not forget to mark the 'useful' or 'correct' post so that others benefit as well.
Maybe you are looking for
-
The Firefox browser is not visible on the home screen, but "browser" is available.
I just got my LG fx0 and the Firefox browser is not on the phone. I watched videos on youtube and all phones in the videos than the Firefox browser. Why is this and how to install Firefox? Section 'system information' the model is madai and the softw
-
Little help needed, can not find the driver
HP Compaq CQ58-d02SL Microsoft Windows 7 x 64 PCI\VEN_10EC & DEV_5229 & SUBSYS_188B103C & REV_01PCI\VEN_10EC & DEV_5229 & SUBSYS_188B103CPCI\VEN_10EC & DEV_5229 & CC_FF0000PCI\VEN_10EC & DEV_5229 & CC_FF00 PCI device Thank you
-
How can I retrieve emails that I deleted
original title: retriving email from my email account I have deleated emails on facebook I need urgently
-
DV 6 factory reset with HP recovery disk
HelloI did a clean install of win7 because I didn't have a HP recovery disk and known a lot of driver problems... When I finally orderd one recovery disc from HP to make it back to factory State, windows does not recognize the recovery disc, since th
-
Should I reinstall Microsoft IntelliType and IntelliPoint?
I currently use a Microsoft Wired Desktop 600 set and I use the software mentioned to customize the buttons. I'll buy a set of Wireless Comfort Desktop 5000 and want to know that my current software will work with them or I have to re - install or up