Change DNS on NIC through Powershell


I needed to change DNS settings on all my servers with static IP and wrong DNS settings.

Password Expire Mail Script


We had a issue at work where all the webmail users called in the same weeks as there passwords was about to expire, they didnt get any notification since they never logon on to a computer, and don’t forget that Windows 7 users dont get the same change password promt as the XP users get, now its just a small notification balloon. Thought this issue would be solved by a quick search for a script on google but didnt find any good ones around that covered all aspects.

There are alot of scripts that gets all users where password is about to expire but they only do the query against one domain, password expire dont replicate as often as needed to just be able to query one DC.

I needed a script that collected all users that are enabled and password was about to expire from all domain so this is what I came up with.

Done, just schedule this script and get rid of all help-desk calls disturbing your morning coffee!

Universal Extractor


Im working with SCCM deployment and sometimes I need to extract a installation file as there silent install just isnt working as it should, Universal Extractor is a great program to extract all files from a installation-file.

Its shell integrated and works like a charm.

Lync 2010 – Add AD users to Lync through Powershell


Here is a script to add AD users automaticly to Lync 2010

This is the simple way of adding every AD user that isnt allready enabled for Lync 2010:

This is the more controlled option if you have a bigger and more complex environment:

If you plan to use the second one or the last one make sure that you have Quest AD commands module installed.

This is the one that I use at my domain

Remove all mapped printers from a specific printserver in powershell


I was working on a print-migration and needed to remove all mapped printers to the old print server on all clients. I made this script and placed it under login script in the same GPO as the new distributed printer GPO. This way then the new printers will be deployed for all users the old ones will automatically be removed.

Change the “\PRINT-SERVER” in the script to your print-server and the script will remove all mapped printers that contain that print-server path.

Done, now all your mapped printers that contained the path entered will be deleted!

Allow interactive users to change power options in Windows (2000, XP, VISTA, 7)


Standard users dont have the privilege to change the power option in Windows (2000, XP, VISTA, 7) so I needed to change this for my users.

All you have to do is give permissions on HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionControls FolderPowerCfg to the Interactive user, this is easily done through GPO.

1. Start GPMC.mmc on your DC
2. Create a new GP or edit an existing one
3. Go to Computer Configuration > Windows settings > Security Settngs > Registry
4. Add a new key and select registry key -> “HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionControls FolderPowerCfg”
5. Give full permission to Interactive user on this and child objects

Activate the GPO and do a gpupdate /force on your test client and check out the result, the interactive user can now change power options.

NZB Cleanup script


A friend wanted me to make a powershell script to clean up his NZB movie/series directory from crap files and sample video as they just take place so since i did a little script for that I might as well share it even if its a basic one.

This script will remove the following files: .sfv , .nfo , nzb and par2 files that might have been missed by the NZB download client.

Just exchange the paths to your own nzb download(s) directory.

Just make the windows scheduler run the script at night and you will always have a nice movie repository =)

How to fully automate installation of Microsoft Forefront Security for SCCM with WSUS update in powershell


I made a script that would automate the installation of Microsoft Forefront Security and add the computer name to the AD Group for Forefront and then update the WSUS server with the computer name and assign it to the right groups. Now there are ways that you can automatically assign client to the right WSUS server through WSUS itself and then this installation script might come in handy.

Files placed on the installation package:

  • install.ps1
  • Forefront Client Security installation package
  • password.txt

Files placed on the WSUS server directory C:ScriptWsus:

  • wsus.ps1
  • addtowsus.ps1

For this to work we need to execute command on remote servers such as the DC and the WSUS server and therefore PSRemoting must be enabled on these servers.

PSRemoting does the following:

  • Starts the WinRM service.
  • Sets the startup type on the WinRM service to Automatic.
  • Creates a listener to accept requests on any IP address.
  • Enables a firewall exception for WS-Management communications.


WSUS – Force the client to register itself


I was working on a installation script for Forefront Client Security and needed the computer to show up in the WSUS server immediately so that the script could assign the computer to different groups and I found a command to do just that.

wuauclt /resetauthorization /detectnow

Computer is now registered in WSUS and shows up immediately.

How to enable “File and Printer Sharing for Microsoft Networks” on NIC with PowerShell


Me and a colleague was working on SCCM implementation for a customer and deploying the client turned out to be a problem, after some investigation in the logs and on the client we found that File and Printer Sharing was disabled on the Network Interface Card (NIC) and therefor the installation got canceled as the computernameadmin$ could not be found.

So I started to google the issue and found no good way on how to enable File and Printer Sharing. Found some information about snetcfg_winxp.exe but I didnt want to uninstall and reinstall the service MS_Server I just wanted to enable the binding for File and Printer Sharing on the NIC.

What I did find was a former Microsoft employee that had made his own tool for modifying network bindings called nvspbind that utilizes the INetCfg APIs that can enable network bindings if it has one of the following information on the network card in hand, GUID or Display Name as it will not recognize the friendly name for example Local Area Connection.

The OS on the target computers were Windows XP and I found it easier to use the Display Name as the GUID on XP machines returned nothing but worked fine on Win7.

Here is a script that I made that we connected to the login script so that all computers will run it, if File and Printer Sharing is allready enabled on the NIC nvspbind will do nothing so its safe to run on enabled systems aswell.

Just point out where you placed the tool nvspbind.exe on the network and run the script and File and Printer sharing will be enabled and a new textfile will be generated with the name of the computer that ran the script.

And now File and Printer Sharing is enabled on all active network cards

Page 3 of 3123
Go to Top