Hello All,
I started a few weeks ago on the PowerShell programing and I got my answer from here only. So am putting up the error that I am getting now to get some help again.
Scenario : I wrote a script that checks a Folder on a server and counts the number of files in it.Then when it finds the resulting number to be more then a specific value(threshold) it sends up a mail to the required alias. To break it all along the portion to send a mail is generated through DBmail using another .PS1 file.
In the PS1 file containing the main checking of number of files I am trying to pass 2 parameters :
1. Folder path on the server
2. the Threshold value of number of files
Now when I created a job to run this powershell script as :
& "C:\PowerShell\Power.PS1" \\XXXX\\c$\Documents and Settings\ABC\Local Settings\Temp 10
IT fails with the error :
A job step received an error at line 1 in a PowerShell script. The corresponding line is '& "C:\PowerShell\Power.ps1" \\XXXX\\c$\Documents and Settings\ABC\Local Settings\Temp 10'. Correct the script and reschedule the job. The error information returned by PowerShell is: 'Cannot convert value "and" to type "System.Int32". Error: "Input string was not in a correct format." '. Process Exit Code -1. The step failed.
I really can not move forward on this.
Please help.
I started a few weeks ago on the PowerShell programing and I got my answer from here only. So am putting up the error that I am getting now to get some help again.
Scenario : I wrote a script that checks a Folder on a server and counts the number of files in it.Then when it finds the resulting number to be more then a specific value(threshold) it sends up a mail to the required alias. To break it all along the portion to send a mail is generated through DBmail using another .PS1 file.
In the PS1 file containing the main checking of number of files I am trying to pass 2 parameters :
1. Folder path on the server
2. the Threshold value of number of files
Now when I created a job to run this powershell script as :
& "C:\PowerShell\Power.PS1" \\XXXX\\c$\Documents and Settings\ABC\Local Settings\Temp 10
IT fails with the error :
A job step received an error at line 1 in a PowerShell script. The corresponding line is '& "C:\PowerShell\Power.ps1" \\XXXX\\c$\Documents and Settings\ABC\Local Settings\Temp 10'. Correct the script and reschedule the job. The error information returned by PowerShell is: 'Cannot convert value "and" to type "System.Int32". Error: "Input string was not in a correct format." '. Process Exit Code -1. The step failed.
I really can not move forward on this.
Please help.