PowerShell COM Object in Scheduled Task
PowerShell COM Object in Scheduled Task
Issue
PowerShell Code Works Interactively but not in Scheduled Task.
Scenario
Using Office COM Object in Scheduled Job.
Code
$visio = New-Object -ComObject Visio.Application $visio.Visible = $false |
Error
- Receive-Job : Exception calling "Open" with "1" argument(s): "
- Receive-Job : You cannot call a method on a null-valued expression.
- Receive-Job : You cannot call a method on a null-valued expression.
Solution
Reference Link
#32 Bit Operating System create a folder called c:\Windows\System32\config\systemprofile\Desktop New-Item -Path c:\Windows\System32\config\systemprofile\Desktop -ItemType Directory -Force -Verbose #64-bit Operating System create both c:\Windows\System32\config\systemprofile\Desktop and c:\Windows\SysWOW64\config\systemprofile\Desktop. New-Item -Path C:\Windows\SysWOW64\config\systemprofile\Desktop -ItemType Directory -Force -Verbose |
Good to use in Client SDK