Translate

vrijdag 17 april 2015

Extract VM details from your XenServer pool

I've been searching for a while to get the VM details like CPU/RAM/Storage from a XenServer pool....

Thanks to my collegue Daniel Zwart we have created a script that will do the trick.

See below for the script:

#!/bin/sh
IFS=$','
vmuuidlist=$(xe vm-list params=uuid is-control-domain=false is-a-snapshot=false power-state=running --minimal)
poolname=$(xe pool-list params=name-label --minimal)
echo VMName,Pool,Host,vCPUs,RAM,Storage,Description > $poolname-vminfo.csv

for vmuuid in $vmuuidlist ; do
    vmname=$(xe vm-list params=name-label uuid=$vmuuid --minimal)
    hostuuid=$(xe vm-list params=resident-on uuid=$vmuuid --minimal)
    vmdescription=$(xe vm-list params=name-description uuid=$vmuuid --minimal)
    hostname=$(xe host-list params=name-label uuid=$hostuuid --minimal)
    vcpus=$(xe vm-list params=VCPUs-number uuid=$vmuuid --minimal)
    ram=$(xe vm-list params=memory-static-max uuid=$vmuuid --minimal)
    vdiuuidlist=$(xe vbd-list vm-uuid=$vmuuid type=Disk params=vdi-uuid --minimal)
    for vdiuuid in $vdiuuidlist ; do
        vdisize=$(xe vdi-list uuid=$vdiuuid params=virtual-size --minimal)
        totalsize=$((totalsize+vdisize))
    done
    totalsize=$((totalsize/1024/1024/1024))
    vmram=$((ram/1024/1024/1024))
    echo $vmname,$poolname,$hostname,$vcpus,$vmram,$totalsize,$vmdescription
done >> $poolname-vminfo.csv

Copy this text to notepad, save it as details.sh or whatever kinda name you want it to. Copy it with WinSCP to your XenServer.

Then issue the command chmod +x details.sh so you can use it.

To verify it has added the 'x' use ls -l

Setup a putty or kitty session to your XenServer, to run the script ./details.sh

The details are added in the CSV, you can copy the CSV with WinSCP, you probably have to refresh the screen before it's visible if you didn't close the earlier made session.

If you open up the file in Excel select the first row > data > text to column > next > select comma > next... Finish.

donderdag 16 april 2015

Adobe is leaving temporary files directory filled RDS\Citrix server

So ever looked at your C:\Users directory at your RDS\Citrix server and wondered why there so many folders with the same name but with extensions like name.000 name.001 etc....

This occured when uncle mickeysoft decided to bring out a patch that did a little tlc to the place where the fonts are stashed. The updates name is KB2993651.

But that update brings also something good, still trying to find out what, but it's unpredictable what happens or what gab exists when you remove the update....

So i created a little workaround here.

After this the user profile files will be deleted when a user presses log off. 

Download this file, no harm it's just a *.ini file ;-)
https://www.dropbox.com/s/qdiu6gctimftcty/acroct.ini?dl=0

Place the file in the netlogon folder \\yourdomain\netlogon

Then go to the GPMC, create a new distinctive name for your policy or add it to an existing computer policy. Go to Computer Configuration > Preferences > Windows Settings > Files > add new file. Then see below for the further details.

Name the full path including the file name, otherwise the magic ain't going to happen.




 



woensdag 8 april 2015

Clear Exchange 2013 Logging periodic and automatically? Yes we can.

Ever wondered why Exchange 2013 is filling your disk, within most of our opinion rubbish.....

Microsoft intended these files for problem logging and BigData.

But i don't want them. And most of us don't want the C: disk blown up from a important server.

Let's start how to get rid of these logging.

First of all you can shut it partially off, but when doing this most of the powerfull tools in Exchange like diagnostics are also powered down.... So don't.

Create a scheduled task on your exchange server.

Go to your desktop and create a file called "clear log files Exchange.xml" then open it and paste the text from below in your document. Save it, then change the blue marked areas. The last green marked item is the amount of days for keeping the logs. I personally set them on 2 days, the - before the amount of days is the days to keep before deleting the logs.

If you want to set this up for the inetpub logs too just change the path. This is marked red.

“C:\inetpub\logs\LogFiles”

Start below here:

<?xml version="1.0" encoding="UTF-16"?>
<Task version="1.4" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
  <RegistrationInfo>
    <Date>2015-04-08T09:26:55.4403987</Date>
    <Author>"domain\User"</Author>
    <Description>cleares the log files from the exchange folder</Description>
  </RegistrationInfo>
  <Triggers>
    <CalendarTrigger>
      <StartBoundary>2015-04-08T09:24:04.030706</StartBoundary>
      <ExecutionTimeLimit>P3D</ExecutionTimeLimit>
      <Enabled>true</Enabled>
      <ScheduleByWeek>
        <DaysOfWeek>
          <Monday />
        </DaysOfWeek>
        <WeeksInterval>1</WeeksInterval>
      </ScheduleByWeek>
    </CalendarTrigger>
  </Triggers>
  <Principals>
    <Principal id="Author">
      <UserId>"domain\User"</UserId>
      <LogonType>S4U</LogonType>
      <RunLevel>HighestAvailable</RunLevel>
    </Principal>
  </Principals>
  <Settings>
    <MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>
    <DisallowStartIfOnBatteries>true</DisallowStartIfOnBatteries>
    <StopIfGoingOnBatteries>true</StopIfGoingOnBatteries>
    <AllowHardTerminate>true</AllowHardTerminate>
    <StartWhenAvailable>true</StartWhenAvailable>
    <RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAvailable>
    <IdleSettings>
      <StopOnIdleEnd>true</StopOnIdleEnd>
      <RestartOnIdle>false</RestartOnIdle>
    </IdleSettings>
    <AllowStartOnDemand>true</AllowStartOnDemand>
    <Enabled>true</Enabled>
    <Hidden>false</Hidden>
    <RunOnlyIfIdle>false</RunOnlyIfIdle>
    <DisallowStartOnRemoteAppSession>false</DisallowStartOnRemoteAppSession>
    <UseUnifiedSchedulingEngine>false</UseUnifiedSchedulingEngine>
    <WakeToRun>false</WakeToRun>
    <ExecutionTimeLimit>P3D</ExecutionTimeLimit>
    <Priority>7</Priority>
  </Settings>
  <Actions Context="Author">
    <Exec>
      <Command>C:\Windows\System32\forfiles.exe</Command>
      <Arguments>/p “C:\Program Files\Microsoft\Exchange Server\V15\Logging” /s /m *.* /c “cmd /c Del @path” /d -2</Arguments>
    </Exec>
  </Actions>
</Task>