Yes, I set to unrestricted. When I'm running it as the user, I'm running from 
the netlogon share.


Sent from my BlackBerry® smartphone on O2

-----Original Message-----
From: Charles F Sullivan <[email protected]>
Sender: "[email protected]" <[email protected]>
Date: Wed, 28 Oct 2015 13:55:47 
To: [email protected]<[email protected]>
Reply-To: "[email protected]" <[email protected]>
Subject: RE: [NTSysADM] PowerShell setting registry value via logon script


 
You did say the execution policy is set correctly, so do you mean unrestricted? 
When you run the script as the user, is it local or on a server? When it’s run 
as a logon script, it’s on Sysvol I assume. That could be the difference if the 
execution policy is remote signed. 
  
 
 
From: 
[email protected] <mailto:[email protected]>  
[mailto:[email protected] <mailto:[email protected]> 
] On Behalf Of James Rankin
 Sent: Tuesday, October 27, 2015 5:58 PM
 To: [email protected] <mailto:[email protected]> 
 Subject: [NTSysADM] PowerShell setting registry value via logon script 
  
I am trying to use a PowerShell logon script to change the user’s profile state 
value in the Registry to simulate a roaming profile (to allow Cookies to be 
saved properly in IE11). To do this I need the user’s SID, which I am pulling 
out and then setting the Registry value. 
  
The script I am using is this 
  
$USERSID = ([Security.Principal.WindowsIdentity]::GetCurrent()).User.Value 
$regpath = "HKLM:\Software\Microsoft\Windows 
NT\CurrentVersion\ProfileList\$USERSID" 
$name = "State" 
Set-ItemProperty -Path $regpath -Name $name -Value "20" 
  
When I run this as the user (logged in), it works perfectly. The Execution 
Policy is set correctly and also I have used a script to change the Registry 
permissions at computer startup so that the user has Full Control of the target 
key. 
  
However, when run as a GPO Logon Script the value is never set. Am I missing 
something here about how PowerShell logon scripts execute? If I use a 
third-party piece of software (AppSense EM) to do this at logon, it also works 
perfectly. 
  
It’s a Windows Server 2012 R2 system running XenApp 7.6 FP3 that I am trying to 
execute this on, for the record. 
  
TIA, 
  
  
  
James Rankin 
EUC Director | HTG TaloSys | 07809 668579 | [email protected] 
<mailto:[email protected]> 
One Trinity Green, Eldon Street, South Shields, Tyne & Wear, NE33 1SA 
Tel: 0191 481 3489 
Email address: [email protected] <mailto:[email protected]> 
Website: www.talosys.co.uk <http://www.talosys.co.uk> 
 phpy9YoGNAM 
  

Reply via email to