Skip to content

Commit

Permalink
fix: remove bad escape characters
Browse files Browse the repository at this point in the history
  • Loading branch information
oskardotglobal authored Dec 18, 2024
1 parent b1e2107 commit a78982b
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions oem/NetProfileCleanup.ps1
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
# Get the current network profile name
$currentProfile = ^(Get-NetConnectionProfile^).Name
$currentProfile = (Get-NetConnectionProfile).Name

# Get all profiles from the registry
$profilesKey = "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkList\Profiles"
$profiles = Get-ChildItem -Path $profilesKey

foreach ^($profile in $profiles^) {
foreach ($profile in $profiles) {
$profilePath = "$profilesKey\$($profile.PSChildName)"
$profileName = ^(Get-ItemProperty -Path $profilePath^).ProfileName
$profileName = (Get-ItemProperty -Path $profilePath).ProfileName

# Remove profiles that don't match the current one
if ^($profileName -ne $currentProfile^) {
if ($profileName -ne $currentProfile) {
Remove-Item -Path $profilePath -Recurse
Write-Host "Deleted profile: $profileName"
}
}

# Change the current profile name to "WinApps"
$profiles = Get-ChildItem -Path $profilesKey
foreach ^($profile in $profiles^) {
foreach ($profile in $profiles) {
$profilePath = "$profilesKey\$($profile.PSChildName)"
$profileName = ^(Get-ItemProperty -Path $profilePath^).ProfileName
$profileName = (Get-ItemProperty -Path $profilePath).ProfileName

if ^($profileName -eq $currentProfile^) {
if ($profileName -eq $currentProfile) {
# Update the profile name
Set-ItemProperty -Path $profilePath -Name "ProfileName" -Value "WinApps"
Write-Host "Renamed profile to: WinApps"
Expand Down

0 comments on commit a78982b

Please sign in to comment.