Error: CallDepthOverflow when running Powershell startup scripts using Group Policy

RajivIyer 96 Reputation points
2021-01-14T09:24:48.51+00:00

Hi,

I am trying to run a powershell script using Startup in a Group Policy. I have mapped the script in Powershell Scripts Tab under Startup section of the GPO. The script contains a one liner command to set the TimeZone information. Below is the code:

Set-TimeZone -Id "India Standard Time"

Below is the error msg:

Error Message = The script failed due to call depth overflow.
Fully Qualified Error ID = CallDepthOverflow

Context:
Severity = Warning
Host Name = ConsoleHost
Host Version = 5.1.17763.592
Host ID = 836b5c03-9d27-402c-b8da-a169188ff709
Host Application = -ExecutionPolicy ByPass -File Set-TimeZone.ps1
Engine Version = 5.1.17763.592
Runspace ID = 23e7e0db-3eb1-404c-828d-aefbd89b8e01
Pipeline ID = 1
Command Name =
Command Type =
Script Name =
Command Path =
Sequence Number = 26
User = LION\SYSTEM
Connected User =
Shell ID = Microsoft.PowerShell

Thanks,
Rajiv

Windows
Windows
A family of Microsoft operating systems that run across personal computers, tablets, laptops, phones, internet of things devices, self-contained mixed reality headsets, large collaboration screens, and other devices.
5,426 questions
Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,537 questions
{count} votes

Accepted answer
  1. RajivIyer 96 Reputation points
    2021-01-18T07:17:45.74+00:00

    The problem occurs when you name the file same as the cmdlet. Renaming the filename to a different name resolves the issue.

    For more information: https://stackoverflow.com/a/65720174/11292785

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.