Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

Folder checking, Function, Workflow, no output

$
0
0

Hello,

I have a function that enumerates folder details for a given machine. I have created a workflow that calls the function. For some reason, I am not getting any output. Clearly it must be some silly mistake. Please help.

Function Check-Inboxes
{
 [CmdletBinding()]
  Param(
    [Parameter(Mandatory=$True, HelpMessage="Server Name", ValueFromPipeline=$True, ValueFromPipelineByPropertyName=$true)]
    [ValidateNotNullorEmpty()]
    [string]$ServerName,
    [Parameter(Mandatory=$True, HelpMessage="Server Name", ValueFromPipeline=$True, ValueFromPipelineByPropertyName=$true)]
    [ValidateNotNullorEmpty()]
    [string]$SiteCode,
    [Parameter(Mandatory=$True, HelpMessage="Inbox Folder Name", ValueFromPipeline=$True,ValueFromPipelineByPropertyName=$true)]
    [ValidateNotNullorEmpty()]
    [string]$FolderName
    )
        $serverdir = "\\$ServerName\SMS_$SiteCode\$FolderName"
        $props= [ordered]@{
        ServerName = $ServerName
        FolderName = $null
        FolderPath = $null
        FolderCount = $null
        FodlerSize = $null
        Date = Get-Date -Format "yyyy-MM-dd";
        Time = Get-Date -Format "HH:mm:ss"; 
        }
        $props.FolderName = (Get-Item -path $serverdir).Name
        $props.FolderPath = (Get-Item -path $serverdir).FullName
        $props.FolderCount = Get-ChildItem $serverdir | where {!$_.PSIsContainer} | Measure-Object | Select-Object -Expand Count
        $fsize = (Get-ChildItem $serverdir -Recurse | where {!$_.PSIsContainer} | Measure-Object -property length -sum)
        $props.FolderSize = "{0:N2}" -f ($fsize.sum / 1MB)
        New-Object -TypeName PSObject -Property $props
}
#Folder Names with Path for Inbox Check
$folders = "Inboxes\","Inboxes\auth","Inboxes\auth\statesys.box\incoming","Inboxes\auth\ddm.box","Inboxes\auth\ddm.box\BAD_DDRS","Inboxes\auth\sinv.box","Inboxes\auth\statesys.box","Inboxes\auth\dataldr.box\retry","Inboxes\auth\dataldr.box","Inboxes\auth\dataldr.box\process","Inboxes\auth\dataldr.box\BADMIFS","Inboxes\ccr.box","Inboxes\ccrretry.box","Inboxes\compsumm.box","Inboxes\Despoolr.box\Receive","Inboxes\Replmgr.box","Inboxes\Replmgr.box\Outbound\high","Inboxes\Replmgr.box\Outbound\low","Inboxes\Replmgr.box\Outbound\normal","Inboxes\Replmgr.box\Incoming","Inboxes\Replmgr.box\Outbound",   "Inboxes\Schedule.box","Inboxes\Schedule.box\tosend","Inboxes\Schedule.box\Outboxes","Inboxes\Schedule.box\Requests","Inboxes\Statmgr.box\Statmsgs"
Workflow run-InboxCheck
{
    Param(
    [string]$ComputerName,
    [string]$SiteCode,
    [string[]]$FolderName
    )
    foreach -parallel ($FName in $FolderName)
    {
        InlineScript
        {
            Import-Module D:\CMHealth\Build\v4\CMDC.psm1 -DisableNameChecking
            Check-Inboxes -ServerName $using:ComputerName -SiteCode $using:SiteCode -FolderName $using:FName
        }
    }
}
$inb = run-InboxCheck -ComputerName WLEULSCCM01 -SiteCode CTR -FolderName $folders


Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>