Managing Printers with PrintUI.DLL May 11, 2009
Posted by Steve in powershell.Tags: powershell
comments closed
Managing printers on client PC’s via the login script can be a useful way to ensure users have consistent printer configuration. This can be achieved by scripting calls to PRINTUI.DLL. These scripts will work on PC’s running Windows 2000, XP and Vista. The calls can be made from batch files, VB Scripts and PowerShell.
Delete a printer a network printer quietly:
rundll32.exe printui.dll,PrintUIEntry /q /dd /n\\server\printer
Add a printer a network printer quietly:
rundll32.exe printui.dll,PrintUIEntry /q /in /n\\server\printer
Set the default printer:
rundll32.exe printui.dll,PrintUIEntry /y /n “printer”
A full list of parameters for the PRINTUI.DLL can be obtained by running this command:
rundll32 printui.dll,PrintUIEntry /?
Powershell Overview May 5, 2009
Posted by Steve in powershell.Tags: powershell
comments closed
Scripting has been around for a long time in virtually every major Operating System since the 1970’s. The humble DOS batch file is probably the most well known and widely used scripting technology in Windows. VB Script improved Windows scripting and is definitely a big step up from the batch file.
The latest scripting technology for the Microsoft platform is PowerShell which can be found at the heart of Windows 2008 Server and many of the latest generation of Microsoft products. Practically every command that can be done via the GUI interface can be scripted and in many cases the GUI will actually show you the PowerShell commands to do the task.
Before you decide to replace your old login script with something new check that you environment meets the requirement of Windows XP SP2 or Windows 2003 SP1 or later. If everything is in order, downloaded PowerShell from here: www.microsoft.com/technet/scriptcenter/topics/msh/download.mspx
Once you have PowerShell installed on your client devices it’s time to start upgrading your login script. Here is a short example that maps a network drive:
# MyScript.ps1
$DriveLetter = “F:”
# Create the Com object
$net = New-Object -com WScript.Network;
# Disconnect the drive if it exists
$net.removenetworkdrive($DriveLetter)
# Map the network drive
$net.mapnetworkdrive($DriveLetter,$UNCPath)
# Open the folder with Windows Explorer
$shell = new-object -comObject Shell.Application
$Shell.open($DriveLetter)
Powershell commands can be called using the command below from other scripts or as a Group Policy script.
- powershell.exe \\server\share\myscript.ps1
The script above is a simple example. The real power of PowerShell comes from more advanced automation e.g. scripting the configuration of an Exchange 2007 or MOSS 2007 environment or create backup jobs in DPM 2007. PowerShell scripts can be used to build a system and then repeat the process in a consistent way. PowerShell is also leveraged by a number of third-party developers to build management functionality into their products e.g Quest and F5 Networks.
If you are serious about developing in PowerShell a number of useful third-party tools are available to help with development. PrimalScript is a power editor with debugging capabilities. PowerGadgets is a library that does many graphical functions including the creation of Vista Sidebar Gadgets.
Powershell Resources:
Free Network Improvements April 29, 2009
Posted by Steve in Networking.Tags: DFS-R, GPO, OWA, powershell
comments closed
Once EBS 2008 is up and running you have a great network foundation on which to build. Here is a short list of things you can do to enhance your network for free using features of Windows 2008, Exchange 2007 or free downloads. You don’t need EBS 2008 to use these features, they are available for SBS 2008 and Windows 2008 Server editions.
Replicating your data
Distributed File System-Replication (DFS-R) allows files to be replicated between Windows servers and works well even across WAN links. Replication can be in one way, two way or a more mesh arrangement between multiple servers.
Accessing your documents remotely using Outlook Web Access
Outlook Web Access (OWA) 2007 includes a direct document access feature that can be configured from Exchange 2007. This provides a quick way to publish read only access to network shares for remote users. CIFS permissions need to be altered if the shares are not on the Exchange Server hosting OWA.
Standardising Office application settings
Download the Office Admin pack for Office 2003 or 2007 and add the .ADM files to the Group Policy Management console. Once installed Group Policies can be created to ensure Office users get consistent settings e.g. File locations, language settings etc.
Printer Management
The Printer Management Console allows management of printers on local and remote print servers from a central location. This greatly reduces the amount of effort required to manage environments with large numbers of printers on multiple Window print servers. It also eases migration of printers between print servers.
Email Disclaimers
Exchange 2007 Transport Rules can be used to add email disclaimers to out going email messages.
How to configure email disclaimers
Learn PowerShell
Powershell can be used to automate tasks that are normally done using the GUI interface. Using Powershell will ensure tasks are done consistently, saves time on repeatitive tasks and allows tasks to be done out side of hours by scheduling scripts.
Extend the EBS 2008 Console
A number of free add-ins can be added to the EBS 2008 Management Console. Currently add-ins are available for SQL 2008, Dynamics and Data Protection Manager.