Code Monkey home page Code Monkey logo

fslogix's Introduction

FSLogix scripts

Various scripts for use with FSLogix Apps, Containers etc. For details on each of the scripts, see the stealthpuppy.com/fslogix site.

fslogix's People

Contributors

aaronparker avatar andreasrogge avatar andyfriar avatar dependabot[bot] avatar dub452 avatar jameskindon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fslogix's Issues

Very problematic when you continue this function.

https://github.com/aaronparker/FSLogix/blob/033e83561769593e77fd08aba027fa81853ef422/Modules/Fslogix.Powershell.Disk/Private/Get-DiskInformation.ps1#L16

Get-DiskImage returns an error "The process cannot access the file because it is being used by another process.", if a user is logged on with the container in $Path.

You should change this to:
Write-Error $Error[0] -ErrorAction Stop

Otherwise, functions like Get-FslDisk will fail, if a container is "in use"!

Remove all values from this file. It's of little utility and a lot of risk to have a generalised exclusion list, people should use default and add in their own exclusions if absolutely necessary.

Review the documentation on Controlling the Content of the Profile Container before making this request.

List the path to add or improve.
A clear and concise description of what the path is and whether it should be excluded or included. Include in the request:

  1. Exclude or include the folder
  2. Path relative to the user profile
  3. What the Copy action should be
  4. A description of what the folder is

Additional context
Add any other context on the folder request here.

[BUG] Remove-Containerdata.ps1 fails when encounters mounted vhd

Describe the bug
The script runs in its native form at first but then fails and kicks out when it encounters a VHD that is mounted.

To Reproduce
Have a user logged into a VDI desktop and run the script on their volume. When it comes to their vhd the script will fail and say that it can't identify a drive letter.

Expected behavior
I expect it to log that the disk is mounted and continue on.

Desktop (please complete the following information):

  • OS: Windows Server 2016 Standard

Additional context
Here's how I got it to keep going past the failure.

I inserted a function that I retrieved from another script that may be one of yours. I modified it some to make it work though.

function checkFileStatus($FileInfo)
{

    try 
    {
        $fileStream = $FileInfo.Open( [System.IO.FileMode]::Open, [System.IO.FileAccess]::Read)
        $filestream.Close()
        return $false
    }
    catch
    {
        
        return $true
    }
}

Then I inserted the bold text below to screen for mounted containers

  # Step through each Container
    ForEach ($container in $Containers) {


        ****$locked = checkFileStatus($container)
        If ($locked -eq $true) {continue}****

Running Remove-ProfileData.ps1 as Logon/Logoff script not working

Hi Aaron,

we were trying to configure your script as a logon/logoff script via GPO but it's not working. I followed your description (https://docs.stealthpuppy.com/docs/fslogix/profile) and edited the script.
The script never launches and fails with an error in eventlog:

_Source: GroupPolicy
Event ID: 1130

Logoff script failed.
GPO Name : xxx
GPO File System Path : \domain.intranet\sysvol\domain.intranet\Policies{E62ED9F0-9D5D-4EED-8720-17B7B9AE9F62}\User
Script Name: Remove-ProfileData.ps1_

It still works if we launch the script manually within the user session. Also other scripts are running fine in our environment.
Do you maybe have any hint for us?

Regards,
Philipp

Remove-ContainerData.ps1 Hyper-V Requirement

Remove-ContainerData.ps1 seems to work without Hyper-V module installed (after bypassing requirement). Is there any functionality in the script that actually requires Hyper-V module? We'd like to avoid installing on any servers in our environment.

Toshiba printer driver cache

Thanks for your efforts

It seems this FSLogix docs link is now broken:

Review the documentation on Controlling the Content of the Profile Container before making this request.

We've just come across an issue with Toshiba Universal 2 printer driver from https://www.toshiba-business.com.au/support/drivers/details?term=e-studio5015ac which we use for a few printers

It bloats user profiles by creating loads of folders in TOSHIBA\eSTUDIOX\UNIDRV\Cache relative to the user profile folder

We used to exclude this folder from CItrix UPM profiles, suggest you add to this list as an Exclusion please, Copy action = 0

Thanks

If you are trying to clean vhd instead of vhdx you will need to edit Container Cleanup Script

Describe the bug
When you are attempting to clean vhd files with the container cleaner script it fails with an error that it can't write the log file. That's because it has 0 files in it's collection. You have to edit the filter on line 258 to "Profile*.vhd" instead of "Profile*.vhdx"

To Reproduce
Steps to reproduce the behavior:
Set path to folders with vhd files

Expected behavior
That will discover vhd files and process them as it would a vhdx.

Desktop (please complete the following information):

  • OS: Windows Server 2016 Standard
  • FSLogix Apps agent version [e.g. 2.9.6964.52690]

Additional context
Add any other context about the problem here.

[BUG] Remove-ProfileData.ps1 does not calculate deleted sizes properly

Describe the bug
A clear and concise description of what the bug is.
Remove-ProfileData.ps1 does not calculate deleted sizes properly.

To Reproduce

Steps to reproduce the behavior:

case 1

1 drop 2 files (each one 70+ MB) into one of the folders listed in targets.xml for deletion

(by this time profile is cleaned up so nothing to delete from there except these files)

C:\Users\username\AppData\Local\Microsoft\Windows\WER
2 run script in whatif mode or -confirm:$false mode
.\Remove-ProfileData.ps1 -Targets .\targets.xml -verbose -confirm:$false
3. script reports deleted files size = 0.42 MiB

===

VERBOSE: Total file size deleted: 0.42 MiB.
VERBOSE: Script took 7945.0875 ms to complete.
Deleted: 0.42 MiB.

===

case 2 (file size is reported properly for 1 file in the folder)
1 drop a file into one of the folders listed in targets.xml for deletion
(by this tie profile is cleaned up so nothing to delete from there except this file)
C:\Users\username\AppData\Local\Microsoft\Windows\WER
2 run script in whatif mode or -confirm:$false mode
.\Remove-ProfileData.ps1 -Targets .\targets.xml -verbose -confirm:$false
3. script reports deleted file size correctly .

Expected behavior
Script report proper size for deleted files.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. Windows 10 1709, ]
  • No Fslogix agent installed, testing on persistent Citrix Xen Desktop

[BUG] Redirections.xml is very aggressive

Describe the bug
If you inclue everyting in redirections.xml , it breaks Windows

To Reproduce
Include everything and things like the Windows Server 2019 start menu completely breaks

Expected behavior
A exclusions file that generically works for both Windows clients and servers

  • OS: [e.g. Windows 10 1709, Windows Server 2019]
  • FSLogix Apps agent 2.9.8440.42104

Additional context
The AppData\Local\Microsoft\Notifications just breaks everything in the start menu....This needs to be removed because its a standard windows feature

Making the Remove-Containerdata.ps1 sort by Container size decending.

Most people like me I think want to start with the largest file and work down instead of alphabetical or native order.

On line 278 I added some text to sort the order from largest to smallest

Where-Object { $_.Length -gt (Convert-Size -From MB -To KB -Value $MinimumSizeInMB) } | Sort-Object Length -Descending

Script is not executed with GPO with parameter confirm:$false

First of all thank you for this creat script!

I have created an user GPO which executes the Profile Cleanup Script. Depending on the parameters that I provide, the script is not automatically executed when you log in. Manually, however, it works without errors.

In this case the script is executed, but the log files is empty and 1KB. As each line to delete must be confirmed:
\share\NETLOGON\fslogix_ProfileCleanup\Remove-ProfileDataSigned.ps1 -Targets "\share\NETLOGON\fslogix_ProfileCleanup\targets.xml" -LogPath D:\FSLogix -Verbose

In this case the script is not executed (see paramenter confirm:$false):
\share\NETLOGON\fslogix_ProfileCleanup\Remove-ProfileDataSigned.ps1 -Targets "\share\NETLOGON\fslogix_ProfileCleanup\targets.xml" -LogPath D:\FSLogix -Confirm:$False -Verbose

The same command with parameter confirm:$false works fine, when exectued manually. Then the logfile is shows all deleted files.

We are using Windows Server 2019 Active Directory and Terminal Servers.

Have you got an idea why the script can't be executed over GPO with paramenter confirm:$false?

Thank you and Regards,
Roberto

Add TempSaves (Power BI) to targets.xml

Hi Aaron,

Please Add TempSaves (Power BI) to targets.xml as we have seen GBs

%UserProfile%\AppData\Local\Microsoft\Power BI Desktop\TempSaves

When a user creates or opens a Power BI Model, Power BI desktop saves a copy under Auto Recovery and Temp Saves. When the user closes without saving, Power BI Desktop will save an Auto Recovered Power BI file under the Auto Recovery file location given under Power BI Options. When you click on “No, remove files”, It will remove files from the Auto Recovery folder. But, files under Temp Saves are still there

https://www.fourmoo.com/2018/01/16/power-bi-loosing-disk-space-when-working-with-power-bi-desktop/

Thanks,
David

Error running \Remove-ContainerData.ps1

When i run .\Remove-ContainerData.ps1 -Path \server\Containers -Targets .\targets.xml

Out-File : Cannot bind argument to parameter 'FilePath' because it is null.
At D:\bat\vdi\Working\Remove-ContainerData.ps1:445 char:148

  • ... .Elapsed.TotalMilliseconds) ms" | Out-File -FilePath $LogFile -Append
  •                                                      ~~~~~~~~
    
    • CategoryInfo : InvalidData: (:) [Out-File], ParameterBindingValidationException
    • FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.OutFileCommand

Out-File : Cannot bind argument to parameter 'FilePath' because it is null.
At D:\bat\vdi\Working\Remove-ContainerData.ps1:446 char:122

  • ... al file size deleted $size MiB" | Out-File -FilePath $LogFile -Append
  •                                                      ~~~~~~~~
    
    • CategoryInfo : InvalidData: (:) [Out-File], ParameterBindingValidationException
    • FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.OutFileCommand

Any help would be appreciated

Thx Alberto

[BUG] ConvertTo-RedirectionsXML.ps1 is missing required metadata properties

When trying to install the script using install-script -name ConvertTo-RedirectionsXML I get an error:
PackageManagement\Install-Package : Script 'C:\Users\user\AppData\Local\Temp\1044593508\ConvertTo-RedirectionsXml\ConvertTo-RedirectionsXml.ps1' is missing required metadata properties. Verify that the script file has Version, Guid, Description and Author properties. You can use the Update-ScriptFileInfo or New-ScriptFileInfo cmdlet to add or update the PSScriptInfo to the script file.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:3500 char:21

  • ... $null = PackageManagement\Install-Package @PSBoundParameters
  •                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidArgument: (C:\Users\user....rectionsXml.ps1:String) [Install-Package], Exception
    • FullyQualifiedErrorId : MissingRequiredPSScriptInfoProperties,Test-ScriptFileInfo,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackage

Desktop (please complete the following information):

  • OS: Windows server2012R2
  • Powershell 5.1.14409.1015

AdditionalRedirectionsList.csv

Aaron,

I see the Redirections.csv only contains a small number of exclusions, but the additionalredirectionslist.csv contains a lot more exclusions. How can we get those converted into our redirections.xml? Or do we have to do it manually? If I just run ConvertTo-RedirectionsXML it only retrieves the redirections.xml, not the additionalRedirectionsList.csv.

Thanks,
Michiel.

Delete Files from root of %Appdata%

Describe the bug
Prune of *.XML files from the root of %AppData% results in a recursive search and delete of subfolders.

To Reproduce
Steps to reproduce the behavior:

  1. Save some *.XML files to the root of %appdata%
  2. Add this to the targets file: %AppData%*.XML
  3. Run the cleaner

Expected behavior
I had expected only the *.XML files in the root of %AppData% to delete. Instead it additionally recursively goes through all sub folders and deletes any other XML files.

Desktop (please complete the following information):

  • OS: Windows 10 21H2
  • FSLogix Apps agent version [2.9.7979.62170]

We utilize a Microsoft Word plugin that was poorly written. It didn't create a subfolder under %AppData% so it dumps it's cache files in the root. They are all .xml and all disposable.

add support for UNC path (UPM store)

Describe the solution you'd like
Hi Aaron,
Could you please add support for UNC paths to cleanup UPM store.

so far I have modified some lines there to point to a profile store, but probable there is cleaner way to script it.

$basefolder= "\pnprofiles\CitrixProfiles\backup"
#$Profilefolders = (Get-Childitem $basefolder -Directory |select name ).Name
$Profilefolders = Get-Content "c:\temp\backup-profiles.txt"

Switch ($Path) {
{ $_ -match "%USERPROFILE%" } { $Path = $Path -replace "%USERPROFILE%", "$basefolder$profilefolder\Win2016x64\UPM_Profile" }
{ $_ -match "%LocalAppData%" } { $Path = $Path -replace "%LocalAppData%", "$basefolder$profilefolder\Win2016x64\UPM_Profile\AppData\Local" }
{ $_ -match "%AppData%" } { $Path = $Path -replace "%AppData%", "$basefolder$profilefolder\Win2016x64\UPM_Profile\AppData\Roaming" }
{ $_ -match "%TEMP%" } { $Path = $Path -replace "%TEMP%", "$basefolder$profilefolder\Win2016x64\UPM_Profile\AppData\Local\Temp" }
}

Additional context
Add any other context or screenshots about the feature request here.

Remove-ProfileData.ps1: Deletes all files and folders listed in Targets.xml

Remove-ProfileData.ps1 currently deletes all files and folders listed in Targets.xml. Right now this approach is used for testing; however, I need to work out whether there are valid scenarios for deleting files over a certain age, or whether we just delete the folders listed in the XML.

We could take a few approaches:

  1. Delete files over a specified age in days
  2. Just delete the listed folder
  3. Delete folders on a schedule (e.g. delete a cache folder once per week)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.