PowerShell script to check WDS Service status against of List of servers.
Below is a powershell script will list WDS Service status againest of List of servers.
$InPutComputersList = get-content "c:\MyScripts\list.txt"
$OutPutFile = "c:\MyScripts\WDS_ServiceStatus.csv"
$NotReachble = "c:\MyScripts\NonPingSystems.csv"
$listResult = @()
foreach($ForEverComputerIntheTextFilelinebyLine in $InPutComputersList) {
if (test-path \$ForEverComputerIntheTextFilelinebyLine\c$\windows\write.exe)
{
$objService = Get-Service WDSServer -ComputerName $ForEverComputerIntheTextFilelinebyLine | select machinename, status, name, displayname
$objResult = New-Object PSObject -Property @{
ComputerName = $ForEverComputerIntheTextFilelinebyLine
ServiceStatus = $objService.Status
ServiceDisplayName = $objService.DisplayName
ServiceName = $objService.Name
}
$listResult += $objResult
}
Else
{
Write-Output "$ForEverComputerIntheTextFilelinebyLine,NotReachable" | out-file $NotReachble -append
}
}
$listResult| Export-Csv -Path $OutPutFile
SCCM 2012 Replication – What is replicated in each type From where to where
There are TWO types of replication can happen
1) Database Replication
2) File-Based Replication
Database Replication Includes Global Data & Site Data
Note:- Apart from above two there is local data this is just to specific to the local site.
Global data includes below : these are flow from CAS to below the Hierarchy
Alert rules |
Client discovery |
Collections rules and count |
Configuration Items metadata |
Deployments |
Operating system images (boot images and driver packages) |
Package metadata |
Program metadata |
Site control file |
Site security objects (security roles and security scopes) |
Software updates metadata |
System Resource List (site system servers) |
Site Data Replication: These are from Client to reporting/assigned Site
Alert messages |
Asset Intelligence client access license (CAL) tracking data |
Client Health data |
Client Health history |
Collection membership results |
Component and Site Status Summarizers |
Hardware inventory |
Software distribution status details |
Software inventory and metering |
Software updates site data |
Status messages |
Status summary data |
File-Based Replication: Earlier products there was only one type of Replication and this is file type. Now with SCCM 2012 this was limited two below types, Mainly used for Software packages and software updates.
File content that replicates by using file-based replication.
File based Data | To the Destination |
Package files used by deployments | Sent to primary and secondary sites. |
Data from secondary sites | Sent to the primary site (parent) of the secondary site. |
Fallback status point state messages | Forwarded to the assigned site when only a single fallback status point is in use. |
Discovery data records | Forwarded to the assigned site when not processed at the site where they are generated. |
SCCM 2012 Client Push – Pre Requirement (HotFix)
The hotfix described in KB2552033 must be installed on site servers that run Windows Server 2008 R2 when client push installation is enabled.
For package pre-stage in 2012
From package right click create "prestage content file" to create the package
This will create the .pkgx file.
Get the file extractcontent.exe from bin/x64
Run the below command
extractcontent.exe /p:e:\path of .pkgx files /s
These two steps will distribute the package as pre-stage method
Script to check the drive space in the server against the threshold value and triggers an alert
#Purpose: Script to check the drive space in the server against the threshold value and triggers an alert
#powershell script for disk space monitoring
$percentWarning = 50; # Store the percentage warning threshold
$disks = Get-WmiObject -ComputerName $computer -Class Win32_LogicalDisk -Filter "DriveType = 3";
$mailbody = "The following drive(s) have less than $percentWarning% free sapce in Server,Please cleanup: $computer`n`n";
$mailbody+="Drive`t`tTotalspace(GB)`t`t`Freespace(GB)`n ________________________________________________________________________ `n";
$drivedata="";
$emailsubject="$computer - Low Disk Space Alert!";
function SendEmail([string]$msg)
{
$SMTPClient = new-object System.Net.Mail.smtpClient;
$SMTPClient.host = "smtp.Domain.com"
$MailMessage = new-object System.Net.Mail.MailMessage;
$MailMessage.Subject = $emailsubject;
$MailMessage.Body = $msg;
$MailMessage.From = "SCOMN_No_Reply@Domain.com";
$MailMessage.To.add("ToJhon@Domain.com");
$SMTPClient.Send($MailMessage);
}
#The following block performs the core functionality
foreach($disk in $disks)
{
$deviceID = $disk.DeviceID;
[float]$size = $disk.Size;
[float]$freespace = $disk.FreeSpace;
$percentFree = [Math]::Round(($freespace / $size) * 100, 2);
$sizeGB = [Math]::Round($size / 1073741824, 2);
$freeSpaceGB = [Math]::Round($freespace / 1073741824, 2);
if($percentFree -lt $percentWarning)
{
$drivedata += "$deviceID`t`t $sizeGB`t`t`t$freeSpaceGB`n";
}
}
#Email to be sent only if any drive has free space less than threshold value
if($drivedata.length -gt 0)
{
$msg=$mailbody+$drivedata;
SendEmail($msg);
}
Source:- http://www.sharepointdiary.com/2012/11/drive-space-monitoring-using-powershell.html