Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

How to determine permission to run certain cmdlet

$
0
0

Hello there,

I have a PS-Script with the following content, which I want to trigger as scheduled task:

Import-Module SMLets
$class = Get-SCSMClass | where{$_.name -match “system.configitem”}
$deletedobjects = Get-SCSMObject -class $class | where{$_.objectstatus -match “Pending”}
$deletedobjects | set-scsmobject -property objectstatus -value deleted

It works with my account, but I'm a local admin and I want to run it via service account. If I setup the schedule task with the service account it does not work.

So I opened a powersehll window in the scope of the service account via "shift+right click". Then I ran the commands step by step without any error. So I don't know how to explore the issue. Any suggestion?



Viewing all articles
Browse latest Browse all 21975

Trending Articles