Couple of issues

Status
Not open for further replies.

NeedSolutions

New Member
Messages
1
Reaction score
0
Hello and thank you for this amazing product, nuhi I am however facing a couple of issues when it comes to building my Windows 10 Pro Image


1) My script will not run. I have written this script to map the NAS drives the user has access to as local drives in File Explorer


Code:
# Define the list of network drives to map
$networkDrives = "\\MyNAS\cracked games", "\\MyNAS\dummy folder", "\\MyNAS\Videos", "\\MyNAS\Images", "\\MyNAS\SysImgs", "\\MyNAS\Szoftver Installacio", "\\MyNAS\EpicGames Games", "\\MyNAS\Ubisoft Connect Games", "\\MyNAS\PlexMediaServer", "\\MyNAS\PLEX Series", "\MyNAS\PLEX Movies", "\\MyNAS1\JL", "\\MyNAS\STEAM Games", "\\MyNAS\Scripts", "\\MyNAS\Transferring C Drive to New PC", "\\MyNAS\Informatika Tovabbkepzes", "\\MyNAS\test"

# Here we type in the username and the password
$Server = Read-Host -Prompt 'NAS nev?'
$User = Read-Host -Prompt 'Felhasznalonev?'
$Password = Read-Host -Prompt 'Jelszo?'

# Here we type in the username and the password
cmdkey /add:$Server /user:network\$User /pass:$Password

# Get the list of used drive letters
$usedLetters = Get-PSDrive -PSProvider FileSystem | Select-Object -ExpandProperty Name

# Map each network drive using the next available drive letter, if not already mapped
foreach ($drive in $networkDrives) {
    $mappedDrive = Get-PSDrive | Where-Object { $_.DisplayRoot -eq $drive }

    if ($mappedDrive -eq $null) {
        $driveLetter = (65..90 | ForEach-Object { [char]$_ }) | Where-Object { $usedLetters -notcontains $_ } | Select-Object -First 1
        New-PSDrive -Name $driveLetter -Root $drive -Persist -PSProvider FileSystem
        Write-Host "Network drive '$drive' mapped successfully as drive '$($driveLetter):'"
        $usedLetters += $driveLetter
    } else {
        Write-Host "Network drive '$drive' is already mapped as drive '$($mappedDrive.Name)':"
    }
}

It doesn't persistently map the drives. Instead it looks like running this script upon user logon as USER - not MACHINE - is the same thing as right click -> Run With Powershell, which also doesn't work in this case. How do I solve this issue? I would absolutely need the drives to be mapped upon user logon through this script.


2) Is there a way to set the default color of the GUI once the user has logged in? I managed to disable Dark Mode thus Windows is in Light Mode which I love, it's beautiful, but I want to set up the specific colors such as Light Grey for the Start Menu, Orange for the Taskbar or sth like that


3) I find that after running the sysprep utility, ALL program activations except for Office - but including Windows 10 Pro itself - is gone. Is there a workaround for this that would still sysprep the image but keep the relevant software activations? I need to activate Poweriso, Office (which does stay activated post-sysprep), Windows 10 Pro to name a few

4) I have the XEROX Phaser 3020 Wireless Printer for which I use a powershell script to set it up as the default printer on the system and also to connect it to the PC. However even tho pre-sysprep, in Audit Mode, I did inject the drivers for this printer, the script failed to set it up as the default printer and connect it to the system
here's the script - which also successfully sets the Network Profile as Private, then enables Network Discovery and File And Printer Sharing for the Network Profile in question -:


Code:
# Set Network Connection as Private
Set-NetConnectionProfile  -NetworkCategory "Private"

# Enable Network Discovery for Private Network Connections
Get-NetFirewallRule -DisplayGroup 'Network Discovery'|Set-NetFirewallRule -Profile 'Private' -Enabled true


# Enable File and Printer Sharing for Private Network Connections
Set-NetFirewallRule -DisplayGroup "File And Printer Sharing" -Enabled True -Profile Private

# Enable Network Discovery for Private Network Connections MAGYAR WINDOWS 10
Get-NetFirewallRule -DisplayGroup 'Hálózat felderítése'|Set-NetFirewallRule -Profile 'Private' -Enabled true


# Enable File and Printer Sharing for Private Network Connections MAGYAR WINDOWS 10
Set-NetFirewallRule -DisplayGroup "Fájl- és nyomtatómegosztás" -Enabled True -Profile Private


# Add Network Printer and Set as Default
$printerName = "Xerox Phaser 3020"

$printer = Get-WmiObject -Class Win32_Printer -Filter "Name='$printerName'"

# Check if the printer is found
if ($printer -eq $null) {
    Write-Host "Printer '$printerName' not found."
} else {
    $printer.SetDefaultPrinter()
    Write-Host "Printer '$printerName' added and set as default."
}

Can I solve this somehow if I absolutely must sysprep?
 
Status
Not open for further replies.
Back
Top