尝试在电话备注中添加创建日期和输入当前日期但只得到 "created on"
Trying to add created on and inputting current date in Telephone Notes but only get "created on"
使用下面的代码,我试图添加一个表示“创建于”的注释,然后给出当前日期,但该日期未填充。提前致谢...
Get-ADuser -Identity $username -Properties info |
ForEach-Object{
$info = $_.Info
$_|Set-ADuser -Replace @{info="$Info`n Created on $date"}
}
您尚未在脚本中的任何地方定义 $date
。尝试以下操作:
Get-ADuser -Identity $username -Properties info |
ForEach-Object{
$info = $_.Info
$date = Get-Date
$_|Set-ADuser -Replace @{info="$Info`n Created on $date"}
}
使用下面的代码,我试图添加一个表示“创建于”的注释,然后给出当前日期,但该日期未填充。提前致谢...
Get-ADuser -Identity $username -Properties info |
ForEach-Object{
$info = $_.Info
$_|Set-ADuser -Replace @{info="$Info`n Created on $date"}
}
您尚未在脚本中的任何地方定义 $date
。尝试以下操作:
Get-ADuser -Identity $username -Properties info |
ForEach-Object{
$info = $_.Info
$date = Get-Date
$_|Set-ADuser -Replace @{info="$Info`n Created on $date"}
}