Sharepoint Powershell表单库-比较日期、更改值

Sharepoint Powershell表单库-比较日期、更改值,sharepoint,powershell,Sharepoint,Powershell,我对Sharepoint Powershell了解不多,但我正在尝试将一些东西组合起来,以自动检查infopath表单库中的过期日期字段与今天的日期 我想比较下一栏中的每个日期 Construction_x0020_Card_x0020_Expiry 直到今天。如果该值小于或小于今天的日期(表示许可证过期或无许可证),请修改以下字段中的文本: Construction_x0020_Card_x0020_Type 这就是我目前所拥有的 if ((Get-PSSnapin "Microsoft

我对Sharepoint Powershell了解不多,但我正在尝试将一些东西组合起来,以自动检查infopath表单库中的过期日期字段与今天的日期

我想比较下一栏中的每个日期

Construction_x0020_Card_x0020_Expiry
直到今天。如果该值小于或小于今天的日期(表示许可证过期或无许可证),请修改以下字段中的文本:

Construction_x0020_Card_x0020_Type 
这就是我目前所拥有的

if ((Get-PSSnapin "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue) -eq      $null) {
Add-PSSnapin "Microsoft.SharePoint.PowerShell"
}

$webUrl = "https://####"
$listDisplayName = "HR Employee Record"
$ExpiryDate = @($Construction_x0020_Card_x0020_Expiry) 
???不确定这是否有效,$Construction\u x0020\u Card\u x0020\u expiration是数组吗

$TodayDate = (Get-Date).ToString("dd-MM-yyyy")
$convertedExpiryDate = $ExpiryDate.ToString("dd-MM-yyyy")
???不确定这是否有效,$Construction\u x0020\u Card\u x0020\u到期日是System.Object[]正在尝试转换为System.DateTime

foreach ($item in $convertedExpiryDate.items | where {$convertedExpiryDate -lt $TodayDate}) {

if ($convertedExpiryDate -eq $null) {
Write-Host @($Construction_x0020_Card_x0020_Type)["$null"]
} elseif ($convertedExpiryDate -lt $TodayDate) {
Write-Host @($Construction_x0020_Card_x0020_Type)["Expired"]
} elseif ($convertedExpiryDate -ge $TodayDate) {
Write-Host @($Construction_x0020_Card_x0020_Type)["Valid"]
}
}

谢谢


兰斯

也许这是不可能的(有人知道这在powershell中是否可行吗?