• Hey Steven.  Looks like you're making progress.  Don't worry... mistakes are expected and you'll learn lots from them and pick up other stuff along the way.

    If I could make a suggestion from a little code review?  There is an easier way to do this loop:

    For($i = 0; $i -lt $list.count; $i++){

    You're showing that you understand the basics of how a loop works.  You're telling it how to increment, when to stop.  Perfect.  But what if you know you just want to do something with every item in a list?  Start at the beginning, stop when you are out of items.  For this you use: Foreach

    foreach($item in $list)

    Try it.  You could also use ($line in $file) -or whatever variable name makes sense to you and the other people reading the code.

    Automation is fun.  Even when it takes 3 times as long to write a script than just do it manually... you might use that code again someday and then you really save time!

  • Oh by all means take it.  Code is meant to be copied and manipulated.  Play with it, change it.  It's not perfect -just a framework to explore toys like parameters with validate options or switch.

    Remember: With Functions in powershell, the function needs to be in the script BEFORE it's called.. that loads it into memory so "get-samaccountname" can be used

  • Here's a function I tossed together that you could call.


    function Get-SamAccountName
    [Parameter(Mandatory = $true,
    Position = 0)]
    [Parameter(Mandatory = $true,
    Position = 1)]
    [Parameter(Mandatory = $true,
    Position = 2)]
    [ValidateSet('CompanyA', 'CompanyB', 'CompanyC')]

    switch ($company)
    return ("$($firstName.Substring(0,1))$($lastname)").ToLower()
    return ("$($firstName).$($lastname)").ToLower()
    return ("$($firstName)-$($lastname.Substring(0, 1))").ToLower()


    Get-SamAccountName -firstName 'John' -lastname 'doe' -company CompanyA
    Get-SamAccountName 'John' 'doe' -company CompanyB
    Get-SamAccountName 'John' 'doe' CompanyC

  • Looking more.. I notice the last application to install is citrix:

    'Event 41033 sent: Application Citrix Workspace 1909 installed successfully'

    Could you remove that from the sequence and try again?  I wonder if citrix installs a virtual NIC that throws MDT off it's game.  Kinda like when you install a video card and the screen blips for a few seconds as it flips over.

  • "No physical adapters present, cannot deploy over wireless"

    Super high level guess: you have bad/conflicting drivers for the NIC on that machine. Perhaps new drivers were releases for ~1903 so... your NIC drivers work fine in Windows PE but when the full OS stands up...?

    Open the device manager on the target machine if you can and see if NIC is loaded.

  • I had setup OS deployment at each site.  Refreshing the image is a not frequent event here and if you can do it at night it will certainly be less intrusive than daytime imaging.

© 4sysops 2006 - 2021


Please ask IT administration questions in the forums. Any other messages are welcome.


Log in with your credentials


Forgot your details?

Create Account