• 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++){
    $list.givenName[$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)
    {
    $item.givenName
    }

    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!

    0
  • 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

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

     

    function Get-SamAccountName
    {
    [CmdletBinding()]
    param
    (
    [Parameter(Mandatory = $true,
    Position = 0)]
    [string]$firstName,
    [Parameter(Mandatory = $true,
    Position = 1)]
    [string]$lastname,
    [Parameter(Mandatory = $true,
    Position = 2)]
    [ValidateSet('CompanyA', 'CompanyB', 'CompanyC')]
    [string]$company
    )

    switch ($company)
    {
    "CompanyA"
    {
    return ("$($firstName.Substring(0,1))$($lastname)").ToLower()
    }
    "CompanyB"
    {
    return ("$($firstName).$($lastname)").ToLower()
    }
    "CompanyC"
    {
    return ("$($firstName)-$($lastname.Substring(0, 1))").ToLower()
    }
    }
    }

    #example:

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

    0
  • Mike J joined the group Group logo of PowerShellPowerShell 2 months ago

    0
  • 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.

    0
  • "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.

    0
  • 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.

    0