Update AD Attributes using Powershell.

I was at a customer the other day installing their new helpdesk portal. When we came to the step to import the users from Active Diretory there was almost no info on the user accounts. Only a first name and last name.

We wanted to be able to Group the users by city and we neded their phone numbers. The easiest way to get this information was from the HR department and then build a CSV file that we used with Powershell to import the information to Active Directory.

To help me edit the csv file that I got from the HR department I used the new feature in Excel 2013 called Flash Fill. You can read more about Flash Fill in this Office Blog http://blogs.office.com/2012/08/09/flash-fill/

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#------------------------------------------------------------------------------------------
# Script created by Chris Steding
#
# This script will update AD attributes for users imported from csv file
# csv file format:
# SamAccountName,Title,MobilePhone,OfficePhone,city,EmailAddress,Department,Office
#
# Remember to edit the -SearchBase to the correct domain name.
#-------------------------------------------------------------------------------------------
 
# Import AD Module
Import-Module ActiveDirectory
 
write-Host 'Starting to update AD Attributes.......' -NoNewline -ForegroundColor Yellow
# Import CSV into variable $users
 
$users = Import-Csv -Path C:\temp\users.csv
# Loop through CSV and update users if the exist in CVS file
 
foreach ($user in $users) {
#Search in specified OU and Update existing attributes
Get-ADUser -Filter "SamAccountName -eq '$($user.samaccountname)'" -Properties * -SearchBase "DC=Compit,DC=local" |
Set-ADUser -Title $($user.Title) -MobilePhone $($user.MobilePhone) -OfficePhone $($user.OfficePhone) -City $($user.City) -EmailAddress $($user.EmailAddress) -Department $($user.Department) -Office $($user.Office)
}
 
Write-Host 'done!' -ForegroundColor Green

Download the script and a csv:
http://www.compit.se/download/script/Update-ADattributes.zip

Have a nice day // Chris

Posted in Active Directory, Powershell, Scripting | Tagged , | Leave a comment

VLC media player 2.1.5 MSI

A new version off VLC media Player has been released from VLC. You can download the new version as an MSI below.

# Created with Adminstudio.
# Updates notifier turned off.
# Tested on Win 7 x64 and Win 7 x86

Download 

x64
http://www.compit.se/download/MSI/VLC Media Player-x64-v2.1.5.msi
http://www.compit.se/download/MSI/VLCMediaPlayer-x64-v2.1.5-en-US.msi

x86
http://www.compit.se/download/MSI/VLC Media Player-x86-v2.1.5.msi
http://www.compit.se/download/MSI/VLCMediaPlayer-x86-v2.1.5-en-US.msi

Download it, test it, deploy it. // Chris

Posted in Uncategorized | 4 Comments

SCCM 2012 R2 Prerequisites Powershell Installer.

Why do it manually when you can have Powershell do it for you…..

You know the felling when you think you are done with all the prerequisites and you start the installation. And BOOOM the installation stops because you are missing a prereq.
If you use Powershell to install the prereq you wont miss any of the prerequisites next time you are going to install SCCM 2012 R2.

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# ***************************************************************************
# 
# Author:    Chris Steding 2014-04-10
# 
# Purpose:   This PowerShell script will install all prereq for SCCM 2012 R2
#     
#
#  * Change the variable for the folderpath if needed.      
#
#
#
# ------------- DISCLAIMER --------------------------------------------------
# This script code is provided as is with no guarantee or warranty concerning
# the usability or impact on systems.
# ------------- DISCLAIMER --------------------------------------------------
#
# **************************************************************************
 
# This scripts needs unrestricted access 
Write-Host "This scripts needs unrestricted access (Set-ExecutionPolicy Unrestricted.)</code><code>" -ForegroundColor Green
Write-Host "The prereq setup for SCCM 2012 R2 takes around 15 minutes depending on your internet speed" -ForegroundColor Green
 
# Setting the variables.
 $folderpath0 = 'D:\Source'
 $ShareName = "Source$"
 
#Check if folder exists, if not, create it
 if (Test-Path $folderpath0){
 Write-Host "The folder $folderPath0 exists."
 } else{
 Write-Host "The folder $folderPath0 does not exist, creating..." -NoNewline
 New-Item $folderpath0 -type directory | Out-Null
 Write-Host "done!" -ForegroundColor Green
 }
 
 # Sharing the Source folder
$Type = 0
$objWMI = [wmiClass] 'Win32_share'
$objWMI.create($folderpath0, $ShareName, $Type)
 
# Check if file exists, if not, download it
 $file0 = $folderPath0+"\adksetup.exe"
 $file1 = $folderPath0+"\MicrosoftDeploymentToolkit2013_x64.msi"
 
 if (Test-Path $file0){
 write-host "The file $file0 exists."
 } else {
 
#Download Windows Assessment and Deployment Kit (ADK) 8.1
		Write-Host "Downloading Windows Assessment and Deployment Kit (ADK) 8.1.." -nonewline -ForegroundColor yellow
		$clnt = New-Object System.Net.WebClient
		$url = "http://download.microsoft.com/download/6/A/E/6AEA92B0-A412-4622-983E-5B305D2EBE56/adk/adksetup.exe"
		$clnt.DownloadFile($url,$file0)
		Write-Host "done!" -ForegroundColor Green
 }
 
 if (Test-Path $file1){
 write-host "The file $file1 exists."
 } else {
 
# Download Microsoft Deployment Toolkit 2013 
		Write-Host "Downloading Microsoft Deployment Toolkit 2013.." -nonewline -ForegroundColor yellow
		$clnt = New-Object System.Net.WebClient
		$url = "http://download.microsoft.com/download/B/F/5/BF5DF779-ED74-4BEC-A07E-9EB25694C6BB/MicrosoftDeploymentToolkit2013_x64.msi"
		$clnt.DownloadFile($url,$file1)
		Write-Host "done!" -ForegroundColor Green
 
 }
 
# Install Windows Features.
Get-Module servermanager
Install-WindowsFeature Web-Windows-Auth
Install-WindowsFeature Web-ISAPI-Ext
Install-WindowsFeature Web-Metabase
Install-WindowsFeature Web-WMI
Install-WindowsFeature BITS
Install-WindowsFeature RDC
Install-WindowsFeature NET-Framework-Features
Install-WindowsFeature Web-Asp-Net
Install-WindowsFeature Web-Asp-Net45
Install-WindowsFeature NET-HTTP-Activation
Install-WindowsFeature NET-Non-HTTP-Activ
 
# Install ADK: Deployment Tools and Windows Preinstallation Enviroment.
 
Write-Host "Installing ADK 8.1 this might take a few minutes.." -nonewline -ForegroundColor yellow
 
Start-Process -FilePath "$folderPath0\adksetup.exe" -Wait -ArgumentList "/quiet /norestart /ceip off /features OptionId.DeploymentTools OptionId.WindowsPreinstallationEnvironment"
 
Write-Host "done!" -ForegroundColor Green
Start-Sleep -s 20
 
# Create no_sms_on_drive.sms on the C drive.
 
Write-host "Creating no_sms_on_drive.sms on the C drive...." -NoNewline -ForegroundColor yellow
New-Item c:\no_sms_on_drive.sms -type file
 
Write-Host "done!" -ForegroundColor Green
 
# Creating the Source folder structure
 
Write-host "Creating Source folders..." -NoNewline -ForegroundColor Yellow
New-Item $folderpath0\Microsoft\_AppName-v1.1.2 -type directory
New-Item $folderpath0\Adobe\_AppName-v1.1.2 -type directory
New-Item $folderpath0\SUN\_AppName-v1.1.2 -type directory
Write-Host "done!" -ForegroundColor Green
 
Write-Host "The server needs to be restarted before you start the SCCM 2012 R2 installation!" -nonewline -BackgroundColor Black -ForegroundColor Red

Download the script as a ZIP file.
http://www.compit.se/download/script/SCCM-2012-prereq-install.zip

// Chris Steding

 

 

 

 

 

Posted in Deployment, Scripting | Tagged , , | Leave a comment

Synology Diskstation change management port.

If you for some reason want to change the management port on your Synology NAS here is the howto.

  •  Logon to your Synology NAS using SSH. (I used Putty.)
  • Login with the username root and the same password you use for the admin account.
  • Type vi  /etc/synoinfo.conf
  • Edit the line admin_port and secure_admin_port. To edit in VI you need to press i and then make your changes.
  • To save your changes press esc and then type :wq
  • Login to the web interface using the default port and then restart the Synology. When restarted you are able to access it using your new port.

 

 

Good Luck :)

Posted in Uncategorized | Leave a comment

VLC media player 2.1.0 MSI

A new version off VLC media Player has been released from VLC.
You can download the new version as an MSI below.

# Created with Adminstudio.
# English meny by default can be changed in preferences.
# Updates notifier turned off.
# Tested on Win 7 x64 and Win 8.1 x64

Download it from:
http://www.compit.se/download/MSI/VLC-MediaPlayer-V2.1.0.msi

x86
http://www.compit.se/download/MSI/VLC-MediaPlayerX86-V2.1.0.msi

Download it, test it, deploy it. // Chris

 

 

Posted in MSI | Tagged | 9 Comments

VLC media player 2.0.8 MSI

Looking for an MSI installer for VLC media player?
Here is the new version.

# Created with Adminstudio.
# English meny by default can be changed in preferences.
# Updates notifier turned off.
# Tested on Win 7 x64.

Download it from:
http://www.compit.se/download/MSI/VLC-MediaPlayer-V2.0.8.msi

 

Have a nice day!

Posted in MSI | Leave a comment

VLC media player 2.0.7 MSI

Looking for an MSI installer for VLC media player?
Then you found the right site to download it from.

# Created with Adminstudio.
# English meny by default can be changed in preferences.
# Updates notifier turned off.
# Tested on Win 7 x64.

Download it from:
http://www.compit.se/download/MSI/VLC-MediaPlayer-v2.0.7.msi

 

Posted in Deployment, MSI | Tagged , | 4 Comments

DPM 2012 SP1 automatic prerequisite installation.

Why do it manually when you can script it? If you script your installations it will be the same result everytime you do it.

This script will install:
.NET Framework
.NET Framework 3.5
Single Instance Store (SIS) (Restart required.)
Microsoft Visual c++ 2008 x64 Redistributable.
Microsoft Visual c++ 2012 x64 Redistributable.

You can download the script from.

http://www.compit.se/download/script/DPM-2012-silent-install.zip

// Chris

Posted in DPM, Scripting | Tagged , | 2 Comments

MDT 2012 Update 1 silent setup.

Time Flies and it’s time to update the MDT script with some new features.

To speed up the installation of Microsoft Deployment Toolkit (MDT) and Windows Assessment and Deployment Kit (ADK) and to get the same setup at all customers I use this PowerShell script to install the programs needed and to setup and configure the Deployment Share.

Purpose:
This PowerShell script will execute all tasks to install a working MDT 2012 Update 1 Install the Feature .NET Framework Installs Windows Deployment Service Install Microsoft Deployment ToolKit 2012 Update 1 Install Windows Assessment and Deployment Kit (ADK)

Folder Structure:
Copy your Windows Setup files, Drivers and applications to the folder structure bellow and then modify your script so that it will import your applications and Windows Setup files.

  • D:\Source
  • D:\Source\Drivers
  • D:\Source\Operating Systems\Windows 7 Enterprise x64
  • D:\Source\Operating Systems\Windows 8 Enterprise x64
  • D:\Source\Applications\Core Applications
  • D:\Source\Applications\Drivers
  • D:\Source\Applications\Optional D:\Source\Applications\Reference Applications

Usage:
Copy the script to the server D:\ Copy your files to the Folder Structure If you already downloaded ADK & MDT copy the files to D:\Source If the files does not exist in the folder D:\Source the script will download them for you. Edit the constant variables in the second part of the script below to meet your needs and enjoy.

Download:

◾PowerShell script and folder structure http://www.compit.se/download/deployment/MDT-2012-update1-silent-install.zip

Save the script and copy it to the D: drive of you server.

Run the script and go and take a coffe.

Happy Deploying!

Posted in Deployment, Scripting | 1 Comment

DPM 2012 SP1 and Exchange 2013 The replica is inconsistent.

After installing Exchange 2013 you need some kind of backup software to backup your Exchange server. I decided to use Microsoft Data Protection Manager 2012 SP1.

According to technet http://technet.microsoft.com/en-us/library/jj651645.aspx
you need the following pre-requisites to install DPM 2012 SP1

• Microsoft .NET Framework 3.5 with Service Pack 1 (SP1)

• Microsoft Visual C++ 2008 Redistributable

• Windows PowerShell 2.0

• Windows Installer 4.5 or later versions

• Windows Single Instance Store (SIS)

• Microsoft Application Error Reporting

Setup automatically installs the pre-requisites if they are not already installed or enabled.

When I started to backup my Exchange 2013 server I was getting an error that the replica of the Exchange databas was inconsistent. The baremetal recovery and system state backup worked fine.

The Error message:

The replica of db01 on SERVER.compit.local is inconsistent with the protected data source. All protection activities for data source will fail until the replica is synchronized with consistency check. (ID: 3106) Data consistency verification check failed for LOGS of  db01 on SERVER.compit.local. (ID: 30146)

The solution:

Install Visual C++ Redistributable for Visual Studio 2012 Update 1 on your DPM 2012 SP1 server. http://www.microsoft.com/en-us/download/details.aspx?id=30679

Inactivate the alerts and Perform consistency check on the databas.

Have a nice day.

Posted in Uncategorized | 7 Comments