Share your PowerShell scripts for Deployment Manager
Moderators: Mike Upton, justin.caldicott, csmith, chirayu, DavidSimner
A simple script to check disk space, and fail the deployment if it's below a certain threshold. Add to PreDeploy.ps1
- Code: Select all
#Disk Space predeployment check
#Create two variables in Deployment Manager:
# InstallationDriveToCheck = drive to check (with colon) eg. C:
# AbortIfDiskSpaceLessThanMB = amount of space which is needed to succeed, in MB eg. 1024 for 1GB
write-host "***Checking space on drive $InstallationDriveToCheck***"
write-host "Deployment will fail if less than $AbortIfDiskSpaceLessThanMB MB available"
$disk = gwmi win32_volume -Filter "driveletter='$InstallationDriveToCheck'"
[int64]$freespace = ($disk.Freespace) / 1024 / 1024 #convert to MB
if ($freespace -lt $AbortIfDiskSpaceLessThanMB)
write-host "Drive $InstallationDriveToCheck has insufficient disk space! ($freespace MB)"
write-host "Drive $InstallationDriveToCheck has $freespace MB free, continuing..."
- Posts: 1144
- Joined: Wed Jun 16, 2010 11:10 am
- Location: My desk.
Return to Deployment Manager PowerShell Scripts
Who is online
Users browsing this forum: No registered users and 0 guests