I still cant register my product....
Posted: Tue Nov 13, 2012 7:25 am
...so Ill continue posting here until you resolve on your end.
I'm using the MonthCalendar in a project to scheduled tasks on a remote server. Unfortunately if you pick a single digit day such as the ninth or month such as February the output is 2/9/2012. Powershell doesn't recognize single digits as valid entries. How do I modify the MonthCalendar so that it outputs as 02/09/2012 and not 2/9/2012?
$m = $monthcalendar1.SelectionEnd.month
$d = $monthcalendar1.SelectionEnd.day
$y = $monthcalendar1.SelectionEnd.Year
Function Create-ScheduledTask {
param(
[string]$ComputerName2 = "myserver",
[string]$RunAsUser2 = "domainaccount",
[string]$RunPass2 = "password",
[string]$TaskName2 = "$taskname",
[string]$TaskRun2 = "'PowerShell.exe -NoLogo -File myserverc$powershelldisable-userDisableUserSchedualed.ps1'",
[string]$Schedule = "$hour"+":"+"$minute",
[string]$Date2 = "$m"+"/"+"$d"+"/"+"$y"
)
$Command2 = "schtasks.exe /create /s $ComputerName2 /U $RunAsUser2 /P $RunPass2 /ru $RunAsUser2 /rp $RunPass2 /tn $TaskName2 /tr $TaskRun2 /sc ONCE /sd $date2 /st $Schedule /F"
Invoke-Expression $Command2
Thanks!
I'm using the MonthCalendar in a project to scheduled tasks on a remote server. Unfortunately if you pick a single digit day such as the ninth or month such as February the output is 2/9/2012. Powershell doesn't recognize single digits as valid entries. How do I modify the MonthCalendar so that it outputs as 02/09/2012 and not 2/9/2012?
$m = $monthcalendar1.SelectionEnd.month
$d = $monthcalendar1.SelectionEnd.day
$y = $monthcalendar1.SelectionEnd.Year
Function Create-ScheduledTask {
param(
[string]$ComputerName2 = "myserver",
[string]$RunAsUser2 = "domainaccount",
[string]$RunPass2 = "password",
[string]$TaskName2 = "$taskname",
[string]$TaskRun2 = "'PowerShell.exe -NoLogo -File myserverc$powershelldisable-userDisableUserSchedualed.ps1'",
[string]$Schedule = "$hour"+":"+"$minute",
[string]$Date2 = "$m"+"/"+"$d"+"/"+"$y"
)
$Command2 = "schtasks.exe /create /s $ComputerName2 /U $RunAsUser2 /P $RunPass2 /ru $RunAsUser2 /rp $RunPass2 /tn $TaskName2 /tr $TaskRun2 /sc ONCE /sd $date2 /st $Schedule /F"
Invoke-Expression $Command2
Thanks!