vFriends.
I have a very specific question to make:
I have a Datacenter with 4 clusters, formed by 14 big hosts and almost 500 VMs. So many VMs showed the need to collect info from them. I have a tool that collects the info through several powershell scripts by myself that connects to the VIServer. Here is an example:
add-pssnapin VMware.VimAutomation.Core Connect-VIServer
vCenterServer.mydomain.com -wa 0 Get-Stat -Realtime -MaxSamples 1
-Stat cpu.latency.average -Entity (Get-VMHost * | Get-VM * | Where-Object {$_.PowerState –eq "PoweredOn"}) | Select-Object
Entity,MetricId,Value | format-table
This one gets the last latency average read of all VMs. There are many others.
It has always worked like a charm, and I have more than 6 months of history and a good source for new investments and managerial decision making.
Until the VCB back up tool started to use a similar way to get info to perform back ups. When my tool is running, the back up never starts. I tried to install the PowerCLI in another server and try to collect from there, but it turned out to be painfully slow to retrieve the data (yes, I disabled the certificate check too) averaged in 5 minutes, compared to the 30sec from inside the vCenter.
OBS: vRealize doesn't give me the info I need. VMTurbo does, but it's too expensive to be bought by now.
Then, I have 3 alternatives that I thought of:
Use the other server and lose 450% of the current data sampling
Ask the BackUp analyst to stop my scripts to perform the back up everytime (causing another big gap in the collected data)
Install another vCenter server in order to run my scripts OR have the back up tool connect to it.
I don't actually want a vCenter to operate in the linked mode feature. I just want another vCenter for those listed purposes, just like an additional Active Directory server in a forest.
Is that possible?
Am I missing another good alternative?
How do I configure it?
Will a Plataform Services Controller server do the trick?
Thanks,
Dave
Related
I'm trying to eventually create a winform powershell tool that manages disk quotas on a Windows 2016 server from a Windows 10 client workstation. Given that Every single user has at least 2 mapped drives is there any way to query a specific user and volume without get-wmiobject cycling through every single quota first? The goal is to create a tool as fast or faster than just remoting into the file server to increase quotas as requests come in but to increase a quota we need to know the quota limit first.
I also know that I could map the root of a drive to a letter using my admin creds, but we don't allow saving credentials for mapped drives because we have to follow guidelines set up by federal government (State Health Care Agency) and our security team doesn't allow for credentials to be saved in any kind of windows logon. So that being said the powers that be are wanting me to find a way around us remoting into the server with our admin credentials and increasing quotas.
We don't use FSRM on the server but instead manage quotas for each volume. That decision was made before my time.
For testing I have tried using the following:
$query = "Select * from win32_diskquota where QuotaVolume=""Win32_LogicalDisk.DeviceID='$volume'"" AND User =""Win32_Account.Domain='$domain',Name='$Username'"""
Get-WmiObject -Query $query -ComputerName server
This one I knew was going to take forever, but tried it anyway:
Get-WMIObject Win32_DiskQuota -ComputerName $computer | where {$_.deviceid -eq "Win32_LogicalDisk.DeviceID=$drive" -and $_.user -eq "Win32_Account.Domain=$Domain"+",Name=$name"}
I've also used get-ciminstance just to see if it would compile the list of quotas from the remote server any faster, but no dice.
Any suggestions, hints, or advice would be great. Thanks in advance.
This script, as with all scripts I use to support domain machines, is being run in our server through RDS man. Same location where all AD machines and user accounts are being managed:
$id = Get-ScheduledTask -CimSession $ComputerName -TaskPath '*EnterpriseMgmt*' | select -Property 'TaskPath' -First 1
I am essentially getting a particular entry in the Task Schedular and have been able to do this on several other remote pcs although this machine seems to be throwing the following error:
WARNING: MKC-02707: [WSManNetworkFailureDetected] The network connection to MKC-02707 has been interrupted. Attempting to reconnect for up to 4 minutes...
WARNING: MKC-02707: [WSManConnectionRetryAttempt] Attempting to reconnect to MKC-02707 ...
WARNING: MKC-02707: [WSManConnectionRetryAttempt] Attempting to reconnect to MKC-02707 ...
The pc in question is on, responding to ping request and enabled in Active Directory. I can't think of why it is doing this or whether there is something in the script that will fix this.
Does anyone have any suggestions? I have a feeling this has something to do with -CimSession.
To continue from the above, I left this one overnight and its working now. Not sure why but if people still want to provide troubleshooting methods for future use I'm sure that would be helpful.
I'm automating windows updates for a set of SQL servers, mostly running on Windows Server 2016. Typically after you install updates you have to reboot, and there is a period of time after rebooting where the server is applying updates and users can't remote into the server. In my automation, I would like to wait until that period of time is over before reporting a successful update. Is there an indicator that I can check remotely through powershell that will determine whether a user can remote in?
I've checked the main RDP services (termservice, SessionEnv and UmRdpService) during this period and they are all running, so if there's some sort of indicator, it isn't them. Maybe there is a field somewhere that states that windows is applying updates? All of the servers are virtualized through VMWare if it matters.
Thanks for reading!
How about testing the port that the remote desktop service listens on?
test-netconnection server -port 3389
I didn't have any luck on ServerFault either, but I did eventually find a solution myself, posting here in case anyone finds this thread looking for help.
The isn't actually a service that changes states when you can RDP back into a server; that's probably determined somewhere in the windows code and there's no way you could find the flag. However, the TIWorker program runs after a reboot to install windows, and in my experience recently, when that exe completes, you can RDP 100% of the time, which is good enough for my automation.
I loop over this piece of code in 5 second intervals until it returns 0 rows, then finish.
Get-Process -ComputerName $server | ? {$_.ProcessName -match 'TiWorker'}
I cannot determine from the System Center Configuration Manager SDK website https://learn.microsoft.com/en-us/sccm/develop/core/misc/system-center-configuration-manager-sdk how to initiate the removal of a computer from all asset collections it may be a part of.
My company now has the ability to build, deploy, and destroy virtual servers all within a few hours. All newly built servers automatically have the SCCM client installed. The current SCCM policy is to remove servers from asset groups that have been inactive for 22 days consecutive days. This is still needed for our legacy environment.
I have been informed from my VM team that there is already code that is automatically run after a virtual server is destroyed. I want to include code that can reach out to our SCCM server to initiate the removal of the server that was destroyed. I have never worked with this kind of approach before and have been unsuccessful on where to even start. I believe it was called API or Hooks.
I would prefer using PowerShell for coding as that is the language I know.
The WMI code to delete a record from sccm would be
$comp = [wmi]"\\<siteserver>\root\sms\site_<sitename>:sms_r_system.resourceID='<resourceid>'"
$comp.psbase.Delete()
To get the ResourceID you can query sms_r_system by name
(Get-WmiObject -computername <siteserver> -query "select resourceID from sms_r_system where name like '<computername>'" -Namespace "root\sms\s
ite_<sitename>").ResourceID
Keep in mind that this may produce more than one entry (which is the reason why we do not delete by name but by ResourceID, so it might be necessary to delete all of the records.
If you have access to the sccm cmdlets (only on a server where the sccm console is installed) it would be:
Get-CMDevice -Name <DeviceName> | Remove-CMDevice
I am working on Powershell scripts to do automated deployments to our servers behind our BIG-IP LTM.
I have simple scripts that use the iControl powershell cmdlets to disable and re-enable the nodes:
Disable-F5.LTMNodeAddress -Node xxx.xxx.xxx.xxx
These work quite well, however for this to become a truly automated process, what I need next is a way to query the Current Connections to the node as they bleed off so that my automation doesn't begin the deployment until current connections = 0.
I've tried the code here without any luck and gone down a few more rabbit holes that didn't get me what I need.
Hoping someone has tried this more recently and had better luck than I am
Thanks!
Found it.
https://devcentral.f5.com/questions/get-local-traffic-statistics-gt-nodes
`$ic = get-F5.iControl
$ic.LocalLBNodeAddress.get_statistics("NODE_IP") | %{$.statistics.statistics | ? {$.type -eq "STATISTIC_SERVER_SIDE_CURRENT_CONNECTIONS"} | %{$_.value.low} }`