3

Script:

$folder = "$env:HOMEDRIVE\TestFolder" New-Item -ItemType directory -Path $folder 
  • note that the same group policy error occurs when $folder is set to "C:\..."

Execution policy is unrestricted, and the script runs fine when ran manually in Windows 8.1 (folder is created). I created a group policy (Computer Configuration > Windows Settings > Scripts > Startup) Added TestFolder.ps1 to \domain.com\SysVol\domain.com\Policies...\Machine\Scripts\Startup. Security Filtering configured to apply to the Domain Computers group. Policy applies fine to computer.

I get the following error when the policy attempts to apply script:

Group Policy event 1130 Startup script failed. GPO Name : TestFolder Script GPO File System Path : \\domain.com\SysVol\domain.com\Policies\...\Machine Script Name: TestFolder.ps1 SupportInfo1 178254400 SupportInfo2 71 ErrorCode 267 ErrorDescription The directory name is invalid. ScriptType 0 GPODisplayName TestFolder Script GPOFileSystemPath \\domain.com\SysVol\domain.com\Policies\...\Machine GPOScriptCommandString TestFolder.ps1 

I can't help but notice that \Scripts\Startup is omitted from the File System Path in the error information... Ideas?

EDIT: The group policy applies to a Windows 7 VM fine. Seems to me a problem with Windows 8.1.

2
  • 2
    Does HOMEDRIVE exist at machine startup, before the user logs on? I'm not sure it does, but I don't have a Windows PC handy to check... Commented Aug 2, 2014 at 7:47
  • I have actually noticed that there does seem to be a difference (I'm guessing with permissions) on directories in the C:\ - C:|windows\system with Windows 7 and Windows 8. I have long suspected there is some sort of added "security" in those directories that makes it harder. Commented Sep 6, 2014 at 4:55

1 Answer 1

1

I don't have any authoritative references, but the $HOME, $env:HOMEDRIVE and $env:HOMEPATH variables are user-specific environment variables.

It's unlikely that they would get assigned when you start a PowerShell host in the security context of the machine and not the user

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.