Open
Description
Issue Type: Bug
Simply put, it's not putting in $currDept (from the first ForEach-Object loop) in the string as expected, except for the last pass. Code and Outputs below.
CODE---------------------
$SearchBaseSuffix = 'ou=Workstations,ou=Machines in Production,dc=xxxx,dc=xxx'
$Departments = 'Alpha
Beta
Gamma
Zulu'.Split("`n")
$OS = 'Windows 7','Windows 10'
$FormFactors = 'Convertibles','Laptops','Desktops'
$Departments | % {
$currDept = $_
Write-Host $currDept
$OS | % {
$currOS = $_
$FormFactors | % {
$currForm = $_
write-host "ou=$currDept,ou=$currForm,ou=$currOS,$SearchBaseSuffix"
# Get-ADComputer -Filter * -Prop 'Description' -SearchBase "ou=$$currDept,ou=$currForm,ou=$currOS,$SearchBaseSuffix" | ft
}
}
}
OUTPUTS------------
Integrated Powershell Output (Incorrect):
Alpha
,ou=Convertibles,ou=Windows 7,ou=Workstations,ou=Machines in Production,dc=xxxx,dc=xxx
,ou=Laptops,ou=Windows 7,ou=Workstations,ou=Machines in Production,dc=xxxx,dc=xxx
,ou=Desktops,ou=Windows 7,ou=Workstations,ou=Machines in Production,dc=xxxx,dc=xxx
,ou=Convertibles,ou=Windows 10,ou=Workstations,ou=Machines in Production,dc=xxxx,dc=xxx
,ou=Laptops,ou=Windows 10,ou=Workstations,ou=Machines in Production,dc=xxxx,dc=xxx
,ou=Desktops,ou=Windows 10,ou=Workstations,ou=Machines in Production,dc=xxxx,dc=xxx
Beta
,ou=Convertibles,ou=Windows 7,ou=Workstations,ou=Machines in Production,dc=xxxx,dc=xxx
,ou=Laptops,ou=Windows 7,ou=Workstations,ou=Machines in Production,dc=xxxx,dc=xxx
,ou=Desktops,ou=Windows 7,ou=Workstations,ou=Machines in Production,dc=xxxx,dc=xxx
,ou=Convertibles,ou=Windows 10,ou=Workstations,ou=Machines in Production,dc=xxxx,dc=xxx
,ou=Laptops,ou=Windows 10,ou=Workstations,ou=Machines in Production,dc=xxxx,dc=xxx
,ou=Desktops,ou=Windows 10,ou=Workstations,ou=Machines in Production,dc=xxxx,dc=xxx
Gamma
,ou=Convertibles,ou=Windows 7,ou=Workstations,ou=Machines in Production,dc=xxxx,dc=xxx
,ou=Laptops,ou=Windows 7,ou=Workstations,ou=Machines in Production,dc=xxxx,dc=xxx
,ou=Desktops,ou=Windows 7,ou=Workstations,ou=Machines in Production,dc=xxxx,dc=xxx
,ou=Convertibles,ou=Windows 10,ou=Workstations,ou=Machines in Production,dc=xxxx,dc=xxx
,ou=Laptops,ou=Windows 10,ou=Workstations,ou=Machines in Production,dc=xxxx,dc=xxx
,ou=Desktops,ou=Windows 10,ou=Workstations,ou=Machines in Production,dc=xxxx,dc=xxx
Zulu
ou=Zulu,ou=Convertibles,ou=Windows 7,ou=Workstations,ou=Machines in Production,dc=xxxx,dc=xxx
ou=Zulu,ou=Laptops,ou=Windows 7,ou=Workstations,ou=Machines in Production,dc=xxxx,dc=xxx
ou=Zulu,ou=Desktops,ou=Windows 7,ou=Workstations,ou=Machines in Production,dc=xxxx,dc=xxx
ou=Zulu,ou=Convertibles,ou=Windows 10,ou=Workstations,ou=Machines in Production,dc=xxxx,dc=xxx
ou=Zulu,ou=Laptops,ou=Windows 10,ou=Workstations,ou=Machines in Production,dc=xxxx,dc=xxx
ou=Zulu,ou=Desktops,ou=Windows 10,ou=Workstations,ou=Machines in Production,dc=xxxx,dc=xxx
Expected Output (Tested, Confirmed in a 'regular' PowerShell session within Code and in a separate PowerShell terminal):
Alpha
ou=Alpha,ou=Convertibles,ou=Windows 7,ou=Workstations,ou=Machines in Production,dc=xxxx,dc=xxx
ou=Alpha,ou=Laptops,ou=Windows 7,ou=Workstations,ou=Machines in Production,dc=xxxx,dc=xxx
ou=Alpha,ou=Desktops,ou=Windows 7,ou=Workstations,ou=Machines in Production,dc=xxxx,dc=xxx
ou=Alpha,ou=Convertibles,ou=Windows 10,ou=Workstations,ou=Machines in Production,dc=xxxx,dc=xxx
ou=Alpha,ou=Laptops,ou=Windows 10,ou=Workstations,ou=Machines in Production,dc=xxxx,dc=xxx
ou=Alpha,ou=Desktops,ou=Windows 10,ou=Workstations,ou=Machines in Production,dc=xxxx,dc=xxx
Beta
ou=Beta,ou=Convertibles,ou=Windows 7,ou=Workstations,ou=Machines in Production,dc=xxxx,dc=xxx
ou=Beta,ou=Laptops,ou=Windows 7,ou=Workstations,ou=Machines in Production,dc=xxxx,dc=xxx
ou=Beta,ou=Desktops,ou=Windows 7,ou=Workstations,ou=Machines in Production,dc=xxxx,dc=xxx
ou=Beta,ou=Convertibles,ou=Windows 10,ou=Workstations,ou=Machines in Production,dc=xxxx,dc=xxx
ou=Beta,ou=Laptops,ou=Windows 10,ou=Workstations,ou=Machines in Production,dc=xxxx,dc=xxx
ou=Beta,ou=Desktops,ou=Windows 10,ou=Workstations,ou=Machines in Production,dc=xxxx,dc=xxx
Gamma
ou=Gamma,ou=Convertibles,ou=Windows 7,ou=Workstations,ou=Machines in Production,dc=xxxx,dc=xxx
ou=Gamma,ou=Laptops,ou=Windows 7,ou=Workstations,ou=Machines in Production,dc=xxxx,dc=xxx
ou=Gamma,ou=Desktops,ou=Windows 7,ou=Workstations,ou=Machines in Production,dc=xxxx,dc=xxx
ou=Gamma,ou=Convertibles,ou=Windows 10,ou=Workstations,ou=Machines in Production,dc=xxxx,dc=xxx
ou=Gamma,ou=Laptops,ou=Windows 10,ou=Workstations,ou=Machines in Production,dc=xxxx,dc=xxx
ou=Gamma,ou=Desktops,ou=Windows 10,ou=Workstations,ou=Machines in Production,dc=xxxx,dc=xxx
Zulu
ou=Zulu,ou=Convertibles,ou=Windows 7,ou=Workstations,ou=Machines in Production,dc=xxxx,dc=xxx
ou=Zulu,ou=Laptops,ou=Windows 7,ou=Workstations,ou=Machines in Production,dc=xxxx,dc=xxx
ou=Zulu,ou=Desktops,ou=Windows 7,ou=Workstations,ou=Machines in Production,dc=xxxx,dc=xxx
ou=Zulu,ou=Convertibles,ou=Windows 10,ou=Workstations,ou=Machines in Production,dc=xxxx,dc=xxx
ou=Zulu,ou=Laptops,ou=Windows 10,ou=Workstations,ou=Machines in Production,dc=xxxx,dc=xxx
ou=Zulu,ou=Desktops,ou=Windows 10,ou=Workstations,ou=Machines in Production,dc=xxxx,dc=xxx
Extension version: 1.12.0
VS Code version: Code 1.32.3 (a3db5be9b5c6ba46bb7555ec5d60178ecc2eaae4, 2019-03-14T23:43:35.476Z)
OS version: Windows_NT x64 10.0.17763
Item | Value |
---|---|
CPUs | Intel(R) Core(TM) i5-4670 CPU @ 3.40GHz (4 x 3392) |
GPU Status | 2d_canvas: enabled checker_imaging: disabled_off flash_3d: enabled flash_stage3d: enabled flash_stage3d_baseline: enabled gpu_compositing: enabled multiple_raster_threads: enabled_on native_gpu_memory_buffers: disabled_software rasterization: enabled surface_synchronization: enabled_on video_decode: enabled webgl: enabled webgl2: enabled |
Memory (System) | 7.91GB (1.91GB free) |
Process Argv | |
Screen Reader | no |
VM | 0% |