0
我試圖創建使用PowerShell 1.0的簡單的計劃任務,並作爲我期待通過MSDN上http://msdn.microsoft.com/en-us/library/windows/desktop/aa383607%28v=vs.85%29.aspx任務計劃程序對象我不知道我真正明白創建一個新的計劃任務我在做......使用PowerShell 1.0
所以在我的代碼,到目前爲止,我有以下幾點:
Function createFirefoxTask() {
$schedule = new-object -com Schedule.Service
$schedule.connect()
$tasks = $schedule.getfolder("\").gettasks(0)
$firefoxTaskExist=$false
# Check if the firefox schedule task exists
foreach ($task in ($tasks | select Name)) {
if($task.name.equals("FirefoxMaint")) {
$firefoxTaskExist=$true
break
}
}
# Create the scheduled task if it does not exist
if($firefoxTaskExist -eq $false) {
write-output "Creating firefox task..."
$firefoxTask=$schedule.NewTask(0)
$firefoxTask | get-member
}
}
但分配給$firefoxTask
成員似乎沒有道理給我。例如,我該如何做一些簡單的命名我的新任務?
這是我收到的輸出...
TypeName: System.__ComObject#{f5bc8fc5-536d-4f77-b852-fbc1356fdeb6}
Name MemberType Definition
---- ---------- ----------
Actions Property IActionCollection Actions() {get} {set}
Data Property string Data() {get} {set}
Principal Property IPrincipal Principal() {get} {set}
RegistrationInfo Property IRegistrationInfo RegistrationInfo() {get} {set}
Settings Property ITaskSettings Settings() {get} {set}
Triggers Property ITriggerCollection Triggers() {get} {set}
XmlText Property string XmlText() {get} {set}
以上成員似乎都不是有意義的東西我想,如果我再鑽到他們做。
你用什麼來獲得'$ cred'值? –
赫姆.. GET-憑證:)'$名氣= GET-憑證「域\用戶」' –
感謝:-)我是一個bash的傢伙..所以我還是很新的,整個世界的PowerShell :-P –