Ask your PowerShell-related questions, including questions on cmdlet development!
Forum rules Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 10 years and 5 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Ill try it, though there was a method to my madness. The servers pulled from AD include decommissioned servers and new server objects, not on the network - WMI yet. New-pssession strips the servers from the csv if they arent on the network.
juneb1022 wrote:Thank you for your help - truly appreciated.
Ill try it, though there was a method to my madness. The servers pulled from AD include decommissioned servers and new server objects, not on the network - WMI yet. New-pssession strips the servers from the csv if they arent on the network.
No it doesn't.
How can you access them if they are not on the network. You are querying AD for the names.
You are not being very clear about what you are trying to do. I thought you wanted to know how to add two CSV files together.
juneb1022 wrote:Thank you for your help - truly appreciated.
Ill try it, though there was a method to my madness. The servers pulled from AD include decommissioned servers and new server objects, not on the network - WMI yet. New-pssession strips the servers from the csv if they arent on the network.
Are you saying that you want a record in the file for servers that don't exist? We have to use a completely different method to do that but it only takes another two lines.
I need the servername, description, and managedby column from AD, and the rest of the columns from WMI (cpu, mem, timezone, ip, etc) into 1 spreadsheet. If there are servers in AD that are not on the network yet - these need to be included in the list too.
Im trying to get the code to work without conactentating files.
Is there any way to get this to work faster? Quering AD then creating the remote sessions is too slow. 15 minutes at 20% completion is not good. I removed the ones I know that are cluster resources,disabled, and decommissioning.
# Retrieve most recent list of Computers from AD
$sessions = Get-QADComputer -searchroot 'sitename' | `
Where-Object { $_.description -notlike "ClusterResource*" -and $_.description -notlike "Disaster*" -and $_.accountisdisabled -eq $False -and $_.description -notlike "*Decom?" } |
ForEach-Object { new-pssession -ComputerName $_.Name
}
This topic is 10 years and 5 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.