User Profile
charlie4872
Brass Contributor
Joined 6 years ago
User Widgets
Recent Discussions
Exporting Users Phone Number From AD Not Formatting Correctly In .CSV File
Hello, I am running a script to export users from AD using the below command Get-ADUser -Filter * -SearchBase "OU=XXX,OU=United States,OU=North America,DC=domain,DC=local" -Properties * |Select -Property Samaccountname,Name,Userprincipalname,telephonenumber | Export-CSV ".\users.csv" -NoTypeInformation -Encoding UTF8 When the script is done the telephone number is not showing correctly. I believe this has something to do with the + and - in the phone number not getting translated correctly. For example a user who has the phone number +1-111-222-3333 comes out in the exported .csv file as something like -7386. I have tried formatting the cells after the export to use different formats but it still does not format it correctly. Is there a way to have the script export the telephonenumber attribute as a string or something so it looks correct in the .csv file?Certificate selection when using 802.1x authentication
Hello I have a question on how a certificate is selected from a computers personal certificates when using 802.1x for wireless authentication using Windows NPS server as RADIUS. I have been having issues with users not being able to authenticate to the office WiFi, and after looking at the logs on the NPS server it shows that the computer is giving the NPS server a certificate other than the one belonging to the computer account. There is a list of certificates in the personal certificate store, and the one certificate for the computer account (given by the on prem PKI) is at the bottom of the list. So it looks like it is just choosing the first certificate in the list, and then failing authentication and not giving the correct cert. Shouldn't it go down the list of certs and eventually giving the correct cert instead of the first one in the list and causing authentication to fail? Hope this make sense any insight is appreciated! Thanks.AD Computer Account Replication
I have a question about computer account creation in AD. If a computer account is created in AD "Site A" and the user tried to log into the computer immediately after it was created from "Site B", and "Site B" is not directly linked in Sites and Services to "Site A", (meaning it would need to replicate to other sites before being replicated to the users local site). Would the user get an error stating the computer account does not exist? Just curious because we have had some issues where computer account creation is automated in one site but when the user logs in they are getting "The Security Database does not have a computer account....." message and I am thinking this may be the reason. The computer account gets created in "Site A" but the local DC in the users site ("Site B") does not have a record of that new computer account and therefore gets the error stated. Thanks in advance!Creating CSV output with headers
Hello I am trying to get the below script to output the results of the script to a .csv file with headers for each of the values gathered from the script. Currently it just outputs a .csv file with the correct info in each column of the sheet but I would like each column to have a header of Group Name, Member Name, Samaccountname, Userprincipalname, Office and Department. I have tried different things but so far nothing is working. Any help is greatly appreciated. Below is what I have now for the scritp. # Get a list of all AD groups and sort them by name $groupList = Get-ADGroup -Filter {name -like 'GLN-GOV*'} | Sort-Object Name | Select-Object Name # Loop through each group and get its members foreach ($group in $groupList) { $memberList = Get-ADGroupMember -Identity $group.Name | get-aduser -properties * | select name,samaccountname,userprincipalname,office,department # Output the group and its members to the file, Change the output location as per your requirements foreach ($member in $memberList) { $output = """$($group.Name)"",""$($member.Name)"",""$($member.samaccountName)"",""$($member.userprincipalname)"",""$($member.office)"",""$($member.department)""" Add-Content -Path ".\testing.csv" -Value $output } }Solved18KViews0likes3CommentsFiltering users with specific license type
Hello. I have a .txt file with a list of users email addresses. I need to comb through that list of users and find which ones have the F3 (old F1) license assigned to them from that list. The script I am running the script below which should only return users who "DO NOT" match E3.. Get-content c:\temp\users.txt | foreach {Get-MsolUser -UserPrincipalName $_ | Where-Object {($_.licenses).AccountSkuId -notmatch "SPE_E3"}} | Select-Object UserPrincipalname,islicensed When I run the script it dumps our a .csv file and in the "islicensed" column it says TRUE for EVERY user. I was told that the -notmatch part should return only those users who are NOT E3 but ever name comes back the same. Anyone know what I am doing wrong? Thanks in advance!3.5KViews0likes0CommentsMove single DHCP scope from one DHCP server to another
Hello I am trying to get a single DHCP scope moved from one DHCP server to another. I am moving DHCP servers with multiple scopes to new servers and the commands I am running now, will export ALL scopes on the server to and .xml file then imported on the new server and this works fine but I have another server with multiple scopes but want to selectively export specific scope(s) only. The commands I am running now are.... To Export. Export-DhcpServer -ComputerName "DHCPSERVERNAME" -Leases -File "C:\temp\DHCP-EXPORT.xml" To Import. Import-DhcpServer -Leases –File "C:\Users\admin\Desktop\DHCP-EXPORT.xml" -BackupPath "C:\Users\admin\Desktop\Backup" –VerboseRe: Get Logon Server From List Of Computers
Thanks for the reply Farismalaeb. I mad the changes you suggested and it returned no results. The .txt file is empty. My goal is to have it output a .csv file with two columns. Computername Logonserver For each of the computers in the computers.txt file.4.6KViews0likes1CommentGet Logon Server From List Of Computers
Hello I am trying to find the logon server $env:logonserver from a list of computers in a .txt file and have the results exported out to a .csv file for a domain migration project I am working on. I attempted this whit the code below but it is not exporting anything useful. Can someone tell me what I am doing wrong and what the proper code would be to get this info? Thanks in advance!! $computers = get-content .\computers.txt $results = foreach ($computer in $computers){ invoke-command -computer $computer -scriptblock {$env:logonserver}} $results | export-csv .\logonservers.csv4.9KViews0likes3CommentsRequest Computer Certificate from CA in another AD Forest
Hello I am wondering if there is a way to generate a certificate request for a computer in one AD forest and use the CSR to generate the certificate on the CA in another AD forest. Does anyone know if this is possible? I cannot find documentation on this in my Google searches. Thanks in advance!Solved1.3KViews0likes2CommentsPinging internal domain name
Hello I have a question that I cannot find answers to when searching Google. What determines which domain controller responds when I ping our internal domain name? It seems when I ping from one computer I get a response from one domain controller and when I ping from another computer I get a response from a different domain controller. I first though maybe it would be a DC in the site to which my subnet belongs but that is not the case. I am getting a response from a DC in a different site. Does anyone know what determines which DC responds when pinging the domain name itself and not a FQDN of a host. Thanks in advance!Solved3.6KViews0likes3CommentsDNS Scavenging Question
Hello All, I have a question I would like to get resolved once and for all. I have DNS entries in out AD DNS that are over a year old. These are not static IP's (they all have a timestamp) and it is causing issues with name resolution. We have scavenging turned on at the zone level but I have noticed that it is not turned on at the server level. Do I need to have "Enable scavenging of stale records" turned on at the server level under DNS server Properties > Advanced? I have done some research and am getting mixed messages about how to properly set this up so we can remove old records and keep DNS as clean as possible. Any help or suggestions is greatly appreciated. Thanks!Write-Host AND output results to text file.
Hello I have a script where I want to write results of "offline" hosts to the terminal and also write the results of the offline computers to a .txt file. The code I have below is what I have so far that writes the results of offline computers to the screen, but I have tried several ways to also write the name of the offline computers to a .txt file but nothing is working. Any help is greatly appreciated. $computers = get-content .\computers.txt foreach ($computer in $computers){ if (Test-Connection -computername $computer -count 1 quiet -erroraction silentlycontinue){ Invoke-Command -ComputerName (Get-Content -Path .\computers.txt) -ArgumentList (Get-Content -Path .\users.txt) -ScriptBlock { $args | Remove-LocalGroupMember -Group "Administrators" -ErrorAction:SilentlyContinue;}} else {write-host "$computer Offline" -foregroundcolor red} }Solved13KViews0likes8CommentsRemove list of users from Local Administrators group on list of computers
Hello, we are trying to remove users from the local administrators group on a bunch of computers. After that we will implement a GPO to control who is added to the local admin group on all computers. What I am looking for is a script to remove multiple users from the local admin group a list of multiple computers. The code below does not seem to be working correctly. Can anyone help with what I am doing wrong? $users = get-content .\users.txt $computers = get-content .\computers.txt foreach ($computer in $computers){ invoke-command -computername $computer -scriptblock {Get-LocalGroupMember -Group 'Administrators' | where {$_.objectclass -like $users} | Remove-LocalGroupmember Administrators} }SolvedOutlook PST Export Question
Hello I have a question about how Outlook handles exporting a PST file for a very large mailbox. If I were to export a attached shared mailbox that is 103GB big, does Outlook portion it out in 10GB chunks the way it does by using the Exchange "New-MailboxExportRequest" does? I am having a hard time getting our Exchange Online admin to fulfill this request so I am wondering if I have it added to my account with Full Access can I just export it myself and have it create consecutive .PST files until the entire mailbox contents are exported? Not having luck Googleing this. Thanks in advance!Solved5KViews1like6CommentsFinding all F3 users from list with PowerShell
Hello I am trying to get a PS script to go through a list of users and filter it out so only the F3 SKU users are listed as TRUE in the isLicensed column in the .csv output. The issue I am having is that when I run the script it is showing ALL users from the users.txt file as TRUE (meaning they should be F3) but when double checking random users they are show up as E3. The script I am using is below. I was told that using the -notmatch should work but no dice. Any ideas how I can get this to work? Many thanks! Get-content c:\temp\users.txt | foreach {Get-MsolUser -UserPrincipalName $_ | Where-Object {($_.licenses).AccountSkuId -notmatch "SPE_E3"}} | Select-Object UserPrincipalname,islicensed | Export-csv c:\temp\Users_Without_E3.csv6.1KViews0likes4Comments
Recent Blog Articles
No content to show