Hi All
I am learning PowerShell for the first time and am having issues with a script.
I am using VMWare with multiple Windows Servers installed and I want to schedule a file transfer using PowerShell.
I created folders on each computer.
C:\ITT430-Files for the member server and
C:\ITT430-Storage on the DC server.
The PS file 'ITT430copy.ps1' is in the
C:\ITT430-Storage and has:
param(
[string]$computerName,
[string]$filePath
)
Copy-Item -Path $computerName -Destination $filePath
-Recurse
The PowerShell code is:
$Action = New-ScheduledTaskAction
-Execute "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe"
-Argument “-NonInteractive -NoLogo -NoProfile -File C:\ITT-Sorage\ITT430Copy.ps1 -SourcePath C:\ITT430-Files* -DestinationPath
\\ITT430\ITT430-Storage"
$Trigger =
New-ScheduledTaskTrigger -Once -At '12AM' -RepetitionInterval (New-TimeSpan
-minutes 15) -RepetitionDuration (New-Timespan -hour 1000)
$Task =
New-ScheduledTask -Action $Action -Trigger $Trigger -Settings
(New-ScheduledTaskSettingsSet)
$Task | Register-ScheduledTask -TaskName 'File
Transfer AutoSync' -User 'administrator' -Password '**********'
$Task
I Get a 0X1 error but not sure what permissions I need. I am already the domain admin and administrator for the computer along with enterprise admin. SO it might be a directory issue but cant see what.
Thanks for any help
Ray