Archive

Posts Tagged ‘PowerShell’

Disable Automatic Updates for Power Query for Excel

October 28, 2016 Leave a comment

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Microsoft Power Query for Excel]
“DisableUpdateNotification”=dword:00000001

or

New-ItemProperty -Path “HKLM:\SOFTWARE\Wow6432Node\Microsoft\Microsoft Power Query for Excel” -Name “DisableUpdateNotification” -PropertyType DWORD -Value 1

Quick Post: Restart a service on a remote computer using PowerShell

April 30, 2015 Leave a comment

Get-Service -Name w32time -ComputerName Server1 | Set-Service -Status Stopped
Get-Service -Name w32time -ComputerName Server1 | Set-Service -Status Running

Categories: Computers Tags:

Quick Post: Get Login Script for Users

February 12, 2015 Leave a comment

Get-ADUser -Filter * -SearchBase “DC=domainname,DC=com” -properties ScriptPath | select Name,ScriptPath

Quick Post: Count users in an OU structure in AD

February 5, 2015 Leave a comment

Get-ADUser -Filter * -SearchBase “OU=Users,OU=Company,DC=domain,DC=com” | Measure

You’ll get something like this.

Count    : 377
Average  :
Sum      :
Maximum  :
Minimum  :
Property :

Quick Post: Get a user’s group membership via PowerShell

February 4, 2015 Leave a comment

Get-ADPrincipalGroupMembership -Identity USERNAME | select name

or

Get-ADUser -Identity USERNAME -Properties MemberOf | Select -ExpandProperty MemberOf

Error Deactivating DHCP Scope

October 21, 2014 Leave a comment

On Windows Server 2008 R2 when using netsh to deactivate a DHCP scope you get an error that says, “The command needs a valid Scope IP Address”.

1 Error

Try again using an elevated PowerShell prompt.

2 Working

Categories: Computers Tags: , , ,

See which distribution list has a specific alias

In this example, find any distribution group that has the word contact in an alias.

Get-DistributionGroup | where {$_.EmailAddresses -match "contact"} | select Name, EmailAddresses | fl
Categories: Computers Tags: ,

PowerShell Cmdlet to export directory & file info

February 29, 2012 Leave a comment

I needed a quick way to export the directory & file info for a certain directory to a CSV file. Open a PowerShell prompt. Navigate to the desired directory. Run the following cmdlet:

Get-ChildItem -Recurse | select Directory,Name,LastWriteTime,Length | Export-Csv C:\Temp\DirTree.txt
Categories: Computers Tags:

Update Fax Numbers in AD Using PowerShell

January 4, 2012 Leave a comment

Just a quick post on how to change the fax number for several users who use 555-555-1234 to 555-555-4321.

 Get-QADUser -SearchRoot "abc.com/ABC/Users" -LdapFilter '(facsimileTelephoneNumber=555-555-1234)' | Foreach-Object{Set-QADuser -Identity $_ -ObjectAttributes @{facsimileTelephoneNumber='555-555-4321'}} 
%d bloggers like this: