Albert Widjaja
asked on
Embedding code from Visual Studio Code indenting issue when replying to thread, not when creating?
To Whom it may concerns,
I notice that when I copy paste a script into the thread, recently it does HTML formatting and breaks all of the indentings. See the below for example.
Can anyone please suggest if this is a known issue in the new EE website or this is an issue in the Visual Studio code?
I notice that when I copy paste a script into the thread, recently it does HTML formatting and breaks all of the indentings. See the below for example.
$ListOfServers = Get-ADComputer -Filter {Enabled -eq $True -and OperatingSystem -like "*Server*"} -SearchBase "DC=Domain,DC=com"
# If you want in in a text files containing server list or names
#$ListOfServers = Get-Content "c:\temp\serv.txt"
Foreach ($Server in $ListOfServers) {
Invoke-Command -ComputerName $Server -ScriptBlock {
# Get Certificate list and assign to a variable
$Certs = Get-ChildItem "Cert:\LocalMachine\My" -Recurse
#To get a list of all cert storage locations.
#(Get-ChildItem -Path "Cert:" -Recurse | Where-Object {($_).GetType().Name -eq 'X509Store'}).Name
# Loop through each object in $Certs
Foreach ($Cert in $Certs) {
# If The objects property "NotAfter" is older than the current time, delete
If ($Cert.NotAfter -lt (Get-Date)) {
$Cert | Remove-Item -WhatIf # Remove the -WhatIf to make it run for real.
}
}
}
}
Can anyone please suggest if this is a known issue in the new EE website or this is an issue in the Visual Studio code?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Test with Beta:
$ListOfServers = Get-ADComputer -Filter {Enabled -eq $True -and OperatingSystem -like "*Server*"} -SearchBase "DC=Domain,DC=com" # If you want in in a text files containing server list or names #$ListOfServers = Get-Content "c:\temp\serv.txt" Foreach ($Server in $ListOfServers) { Invoke-Command -ComputerName $Server -ScriptBlock { # Get Certificate list and assign to a variable $Certs = Get-ChildItem "Cert:\LocalMachine\My" -Recurse #To get a list of all cert storage locations. #(Get-ChildItem -Path "Cert:" -Recurse | Where-Object {($_).GetType().Name -eq 'X509Store'}).Name # Loop through each object in $Certs Foreach ($Cert in $Certs) { # If The objects property "NotAfter" is older than the current time, delete If ($Cert.NotAfter -lt (Get-Date)) { $Cert | Remove-Item -WhatIf # Remove the -WhatIf to make it run for real. } } } }
I think the text from code is copied properly (as I can saw it in Notepad+ displayed nicely) but somehow the new Beta version of Code doesn't work so well at this moment (I also facing some indent and alignment issues by using the Beta's Code feature)
ASKER
Yes, it seems this is server-side issue, not my browser (Client side issue).
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
$ListOfServers = Get-ADComputer -Filter { Enabled -eq $True -and OperatingSystem -like "*Server*" } -SearchBase "DC=Domain,DC=com"
# If you want in in a text files containing server list or names
#$ListOfServers = Get-Content "c:\temp\serv.txt"
Foreach ($Server in $ListOfServers) {
Invoke-Command -ComputerName $Server -ScriptBlock {
# Get Certificate list and assign to a variable
$Certs = Get-ChildItem "Cert:\LocalMachine\My" -Recurse
#To get a list of all cert storage locations.
#(Get-ChildItem -Path "Cert:" -Recurse | Where-Object {($_).GetType().Name -eq 'X509Store'}).Name
# Loop through each object in $Certs
Foreach ($Cert in $Certs) {
# If The objects property "NotAfter" is older than the current time, delete
If ($Cert.NotAfter -lt (Get-Date)) {
$Cert | Remove-Item -WhatIf # Remove the -WhatIf to make it run for real.
}
}
}
}
There was no "clean" pop up?
ASKER
thanks!
it is definitely a bug in the beta version.
it is definitely a bug in the beta version.
ASKER
This is when I reply from VS code with the same clipboard content:
Code below is embedded with the proper [code][/code] tags: