If I run my PS script with PS as an ADMIN interactively it runs fine. If I attempt to run it as a SQL Agent job it has issues. I think the problem is it needs to run as an ADMIN but I cannot figure out how to do that. Has anyone had issues running a PS Script as a SQL Agent job? The ID running this is an Admin on the server and within SQL Server as well.
New-Item : Access to the path 'C:\Users\SVC_TP~1\AppData' is denied.
At line:28 char:13
+ $null = New-Item -Path $temp -ItemType Directory -Force
+ CategoryInfo : PermissionDenied: (C:\Users\SVC_TP~1\AppData\Local\Temp:String) [Ne
+ FullyQualifiedErrorId : CreateDirectoryUnauthorizedAccessError,Microsoft.PowerShell.Command