none
Powershell in Windows 2019 Server

    Question

  • In Windows 2008r2 the following worked flawlessly,

    #Get Client Name
    
     GC ENV:CLIENTNAME
    
    #Set Environment Variable based on client name
    
    switch ($ENV:CLIENTNAME)
    {
    "yosemite1" { set-item ENV:USER# 1 }
    "yosemite1" {$printer = Get-WmiObject -Query "Select * From Win32_Printer Where Name = 'YReceipt'"}
    "yosemite1" {$printer.SetDefaultPrinter()}

    This no longer works in Windows 2019 Server. I need this to set a certain environment variable that our point of sale software uses to determine the workstation that the user is connecting from and sets a default printer for that session. I know I can set this statically but I have more users than workstations and some users move between store locations.

    Any help is appreciated.

    Thanks.



    Thursday, May 2, 2019 11:57 PM

Answers

All replies