Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
Is there anyway to find just disk size from QlikView. We are not interested to know sub folders,QVW sizes etc.
We just need Disk size (currently filled)
Thanks,
Chiru.
Thanks a lot Marcus and Steve.
Thanks,
Chiru
I'm not a big fan of macros, so I thought I would set about trying to do this in the load script instead.
Attached is what I came up with.
It runs a cmd.exe directory statement in the load script, and stores that to a file. That file is then parsed to get the total size of all files on the disk and the remaining space, giving a percentage free:
The process of creating the file for a busy drive takes quite a while (and can be skipped in the script with the vIncSub switch.
To use the app in QlikView you need to ensure that you enable Can Execute External Programs:
I'm sure there are more elegant DOS commands to give you the drive usage and space - but hopefully this demonstrates how you can get data from the system into QlikView or Qlik Sense.
Steve
Steve, with your permission I made a small adjustment to use some PS cmdlets instead of DOS commands. Simply because the script code looks simpler and WMI has a tendency to provide more correct information. Although I'm the first one to admit that a free-drive-space tally cannot be guaranteed for more than a few milliseconds
All other requirements till apply.
Best,
Peter
Thanks Steve and I liked this idea very much.I was also trying to avoid macros and no luck earlier.
Because of some reason I am getting an error like below.Basically QV program is not able to access the file it created using Dos Command it seems
I tried to change the path to my desktop folder.But no luck.
I have two questions and nee your help
(1) Can I save the filesize.txt anywhere I want ?
(2) Will I be able to run this QVW from QMC also ? Because I am always asked for "Give system access" through pop up ?
Hi Peter,
Thanks for expanding in this way. I knew there must be better DOS statements out there - but I am not a DOS expert.
Steve
Hi Naga,
You should be able to write the file wherever you like. Does c:\temp exist on your system? Note that the file path exists in both the load and where the file is being piped to from the DOS command. Does the file get written to the right place - it should persist after the load is complete.
You should be able to allow system access apps through the QMC. I was getting the pop-up every time also, but I am sure I have had apps where I have just confirmed this once and it has been fine in the past. It may be something that has changed at a later version of QlikView.
I don't have a Server I can try this out on at the moment - so you will just have to try it and see.
Steve
Thanks a lot Steve and peter.
I am able to run the script finally.
Thanks,
Chiru
Thanks Peter.I am able to run the script.
I have one final question.Instead of all mapped drives If I want to check size of a particular external server drive for which I have access,
How can I can tweak below code (to hard code that drive path)
EXECUTE powershell.exe "Get-WmiObject Win32_LogicalDisk | Select-Object DeviceID, DriveType, Size, FreeSpace | Export-Csv -path C:\Users\C757979\Desktop\Temp\FileSystem.csv -Notype";
Thanks,
Chiru
Just add a WHERE statement to the load from the CSV file:
WHERE DriveType = 3 // Disk drives only
AND DeviceID = 'C:'
;
Watch out for the semi colon.
Steve
If on the other hand you want to check disk space of a drive on a remote computer ("external server"), you may want to add the -computername option to the Get-WmiObject cmdlet. Like in:
EXECUTE powershell.exe "Get-WmiObject Win32_LogicalDisk -computername servername | Select-Object DeviceID, DriveType, Size, FreeSpace | Export-Csv -path C:\Users\C757979\Desktop\Temp\FileSystem.csv -Notype";
Best,
Peter