Hi,
Before we provision our desktopservers we need to delete all userprofiles from the registry except the following usernames: Administrator and CTX_Streaminig.
This is what i got now:
$REGPROF=REGISTRY::HKLM\Software\Microsoft\Windows NT\CurrentVersion\ProfileList $PROFLIST=GET-CHILDITEM $REGPROF FOREACH ( $ITEM in $PROFLIST ) { $userid=(get-itemproperty registry::$item).ProfileImagePath write-host @userid if ($userid -notlike @("*administrator*","*Ctx_StreamingSvc","*NetworkService*","*Localservice*","*systemprofile*")) { $userid; remove-item registry::$item } }
Why isn't it working, my administrator account is deleted and networkservice, localservice and systemprofiles also?
write-host @ userid shows:
C:\Windows\system32\config\systemprofile
C : \ W i n d o w s \ S e r v i c e P r o f i l e s \ L o c a l S e r v i c e
etc. There are spaces in between?
Please help me out here....
Thanks!
- Edited by J is my name Friday, December 19, 2014 8:18 AM