0

I have a script that exports data to a csv file listed below:

    $url = "http://portal.contoso.com"
$site = New-Object Microsoft.SharePoint.SPSite($url)
$web = $site.OpenWeb()
$list = $web.Lists

function Get-DocInventory() {   

                $web = Get-SPWeb "http://portal.contoso.com"

                    foreach ($list in $web.Lists) {

                        if ($list.BaseType -eq "DocumentLibrary") {

                         $dList = [Microsoft.Sharepoint.SPDocumentLibrary]$list
                         $items = $dList.Items
                         $files = $dList.CheckedOutFiles

                        foreach($file in $files){

                           foreach($item in $items){

                                if($item["Checked Out To"] -ne $null){

                             $wuse = $file.DirName.Substring($web.ServerRelativeUrl.Length)                          
                             $modifiedTime = $web.RegionalSettings.TimeZone
                             $data = @{
                                "Version" = $item["Version"]
                                "library" = $wuse
                                "URL" = $web.Url + ('/') + $item.Url
                                "Title" = $file.LeafName
                                "CheckedOut By" = $file.CheckedOutBy.Name
                                "Time last Modified" = $modifiedTime.UTCToLocalTime($file.TimeLastModified)

                            }
                           }

                              New-Object PSObject -Property $data

                            }
                          }                        
                       }
                    }
                    $web.Dispose();
                }
                $site.Dispose()

        }


Get-DocInventory | Export-Csv -NoTypeInformation -Path D:\Docinventory.csv

I need help to add a Powershell script to email the csv file to the Owners Group. Could someone please assist?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.