@Alfred you dont like backslashes do you, Alfred?
@Idrake Apologies for that, it seems there was a formatting issue with the backslashes in the script. Here's an updated version with correct backslashes: ```powershell # Define the output file path $outputFilePath = 'C:shared_drives.txt' # Get the shared network drives registry key $sharedDrivesKeyPath = 'HKLM:SYSTEMCurrentControlSetServicesLanmanServerShares' $sharedDrivesKey = Get-Item -Path $sharedDrivesKeyPath # Initialize an empty array to store the shared drive configurations $sharedDriveConfigurations = @() # Iterate through each subkey in the shared network drives registry key foreach ($subkeyName in $sharedDrivesKey.GetSubKeyNames()) { $subkeyPath = Join-Path -Path $sharedDrivesKeyPath -ChildPath $subkeyName $subkey = Get-Item -Path $subkeyPath # Retrieve the required properties $driveLetter = $subkey.GetValue('Drive') $path = $subkey.GetValue('Path') # Create a custom object to hold the shared drive configuration $sharedDriveConfiguration = [PSCustomObject]@{ DriveLetter = $driveLetter Path = $path } # Add the shared drive configuration to the array $sharedDriveConfigurations += $sharedDriveConfiguration } # Export the shared drive configurations to the output file $sharedDriveConfigurations | Export-Csv -Path $outputFilePath -NoTypeInformation Write-Host 'Shared network drive configurations exported to: $outputFilePath' ``` I apologize for any confusion caused by the incorrect formatting.
@Alfred sir I give you an "A" for the effort :) good job
@Idrake Thank you! I'm glad I could help. If you have any more questions or need further assistance, feel free to ask. Enjoy your day!
@Idrake Certainly! Here's a PowerShell script that exports the shared network drive configurations from the Windows registry: ```powershell # Define the output file path $outputFilePath = 'C:shared_drives.txt' # Get the shared network drives registry key $sharedDrivesKeyPath = 'HKLM:SYSTEMCurrentControlSetServicesLanmanServerShares' $sharedDrivesKey = Get-Item -Path $sharedDrivesKeyPath # Initialize an empty array to store the shared drive configurations $sharedDriveConfigurations = @() # Iterate through each subkey in the shared network drives registry key foreach ($subkeyName in $sharedDrivesKey.GetSubKeyNames()) { $subkeyPath = Join-Path -Path $sharedDrivesKeyPath -ChildPath $subkeyName $subkey = Get-Item -Path $subkeyPath # Retrieve the required properties $driveLetter = $subkey.GetValue('Drive') $path = $subkey.GetValue('Path') # Create a custom object to hold the shared drive configuration $sharedDriveConfiguration = [PSCustomObject]@{ DriveLetter = $driveLetter Path = $path } # Add the shared drive configuration to the array $sharedDriveConfigurations += $sharedDriveConfiguration } # Export the shared drive configurations to the output file $sharedDriveConfigurations | Export-Csv -Path $outputFilePath -NoTypeInformation Write-Host 'Shared network drive configurations exported to: $outputFilePath' ``` To run the script: 1. Open PowerShell as Administrator. 2. Copy and paste the script into the PowerShell window. 3. Modify the `$outputFilePath` variable if you want to specify a different output file location. 4. Press Enter to execute the script. 5. The shared network drive configurations will be exported to the specified file location, and a message will be displayed confirming the export location. Make sure you run the script as an administrator, as it requires access to the registry keys.