File tree 5 files changed +68
-20
lines changed
Scripts/WindowsCredentials
5 files changed +68
-20
lines changed File renamed without changes.
Original file line number Diff line number Diff line change
1
+ @ {
2
+ ModuleName = ' Remove-EmptyFolders'
3
+ ModuleVersion = ' 1.0.0'
4
+ Author = ' Tyler Jaacks'
5
+ Description = ' A module to delete empty folders recursively.'
6
+ FunctionsToExport = @ (' Remove-EmptyFolders' )
7
+ }
8
+ function Remove-EmptyFolders {
9
+ param (
10
+ [string ]$Path = (Get-Location )
11
+ )
12
+
13
+ if (-not (Test-Path - Path $Path )) {
14
+ Write-Error " The path '$Path ' does not exist."
15
+ return
16
+ }
17
+
18
+ # Recursively get all folders
19
+ $folders = Get-ChildItem - Path $Path - Directory - Recurse
20
+
21
+ # Sort folders by depth to delete the deepest folders first
22
+ $folders = $folders | Sort-Object { $_.FullName.Split (' \' ).Count }
23
+
24
+ foreach ($folder in $folders ) {
25
+ # Check if the folder is empty
26
+ if (-not (Get-ChildItem - Path $folder.FullName - Recurse - ErrorAction SilentlyContinue)) {
27
+ try {
28
+ Remove-Item - Path $folder.FullName - Force
29
+ Write-Output " Deleted empty folder: $ ( $folder.FullName ) "
30
+ } catch {
31
+ Write-Error " Failed to delete folder: $ ( $folder.FullName ) . Error: $_ "
32
+ }
33
+ }
34
+ }
35
+ }
36
+
37
+ # Export the function to be available to users of the module
38
+ Export-ModuleMember - Function Remove-EmptyFolders
Original file line number Diff line number Diff line change
1
+ $PSMRoot = " D:\Documents\Projects\PowerShell\PowerShellScripts\Modules"
2
+
3
+ # TODO: Figure out how to replace this with something else.
4
+ Import-Module - DisableNameChecking " $PSMRoot \Manage-StoredCredentials"
5
+
6
+ @ {
7
+ ModuleName = ' Remove-XboxCredentials'
8
+ ModuleVersion = ' 1.0.0'
9
+ Author = ' Tyler Jaacks'
10
+ Description = ' A module to remove Xbox related credentials from the Credential Manager.'
11
+ FunctionsToExport = @ (' Remove-XboxCredentials' )
12
+ }
13
+ function Remove-XboxCredentials {
14
+ $credentials = Manage- StoredCredentials - ShoCred - All
15
+
16
+ foreach ($cred in $credentials | Where { $_.Target -like " *Xbl*" } ) {
17
+ Manage- StoredCredentials - DelCred - Target $cred.Target - CredType GENERIC
18
+ }
19
+
20
+ foreach ($cred in $credentials | Where { $_.Target -like " *MCL*" } ) {
21
+ Manage- StoredCredentials - DelCred - Target $cred.Target - CredType GENERIC
22
+ }
23
+ }
24
+
25
+ # Export the function to be available to users of the module
26
+ Export-ModuleMember - Function Remove-XboxCredentials
Original file line number Diff line number Diff line change 1
- oh - my - posh -- init -- shell pwsh -- config D:\config.json | Invoke-Expression
1
+ $PSMRoot = " D:\Documents\Projects\PowerShell\PowerShellScripts\Modules "
2
2
3
- # Import the Chocolatey Profile that contains the necessary code to enable
4
- # tab-completions to function for `choco`.
5
- # Be aware that if you are missing these lines from your profile, tab completion
6
- # for `choco` will not function.
7
- # See https://ch0.co/tab-completion for details.
3
+ oh- my- posh init pwsh -- config ' https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/powerlevel10k_modern.omp.json' | Invoke-Expression
8
4
9
- $ChocolateyProfile = " $env: ChocolateyInstall \helpers\chocolateyProfile.psm1"
10
-
11
- if (Test-Path ($ChocolateyProfile )) {
12
- Import-Module " $ChocolateyProfile "
13
- }
14
-
15
- if (Test-Path ' D:\.inshellisense\key-bindings-pwsh.ps1' - PathType Leaf){. D:\.inshellisense\key- bindings- pwsh.ps1}
5
+ Import-Module " $PSMRoot \Remove-EmptyFolders.psm1"
6
+ Import-Module " $PSMRoot \Remove-XboxCredentials.psm1"
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments