Eject CD script, quarantined by FEP! PowerShell to the rescue!

I guess everyone knows that you can’t enable BitLocker on a machine from a Task Sequence if there is a CD in the CD drive… The workaround is quit simple, just run a script to eject the cd drive before running the “enable BitLocker” step. Well the other day this script, a vbs, I use, was removed by Forefront.. I guess the heuristic scan evaluated the content of the script to be unsafe, and quarantined it.. This is obviously not good, as it’s needed by the task sequence… So I thought, maybe there is a way to eject the CD [...]

By |2012-03-22T12:25:53+01:00marts 22nd, 2012|General info, OS Deployment, Powershell, Security|3 Comments

Small useful scripts–Changing Driver Package source (PS1)

I have this customer who had to move all driver packages from from one server a another. This of cause meant all the Data Source references had to be change as well. Once al the packages were moved to the new server I ran the following  two scripts to change the source. All you need to change is the $Site to your site code, or add it is a parameter when you run the script. You will obviously also have to type in the old and new path. Syntax: Script.ps1 –Site XXX If you want to only run against one [...]

WMI/ConfigMgr Scripting: CreateEmbeddedObjectInstance (.NET) or SpawnInstance (VBScript) in PowerShell

  During the development of the script I posted yesterday, I noticed that a lot of people had problem discovering how to create WMI objects in PowerShell. I found different suggestions, but they all had problems. When I have to create WMI object instances I use this this method, which I used in my old script about sharing folders here is an example: $SecDesc = ([WMIClass] "\\$ComputerName\root\cimv2:Win32_SecurityDescriptor").CreateInstance() using configuration manager development we have to create a lot of wmi objects. Take a look at this SDK Sample in the VBScript example we have this line: ' Create and populate a [...]

By |2011-09-27T10:22:30+01:00september 27th, 2011|Configuration Manager (SCCM), Powershell, Scripting & Development|Kommentarer lukket til WMI/ConfigMgr Scripting: CreateEmbeddedObjectInstance (.NET) or SpawnInstance (VBScript) in PowerShell

System Center Orchestrator 2012 Beta: Using Run .Net Script Activity – PowerShell: Inputting and Returning Data

[download id="50"] This article describes how to use the Run .Net Activity to run PowerShell Scripts. I have created an example runbook which does the following: Start once every minute. Read a text file containing a list of sites/servers. Parse the list to PowerShell script. PowerShell script tried to ping each address and get the response time. PowerShell script output formatted HTML, ready to put inside a HTML Table, containing the addresses and response time. Runbook writes a web site based on a HTML template. The result is a website, in my case it looks like this: NB! some websites/server [...]

Exchange and Activesync: Limiting the mailbox to sync with only one device

Just came back from a customer which needed to limit the number of mobile device to one per mailbox. For this implementation the customer used all kind of smart phones, so the challange was also to find the unique Device ID from the Smartphone and add it to a Active Directory Attribute called: msExchMobileAllowedDeviceIDs. I created a Powershell script which read a text file and add the ID to AD. The script is also adding a dummy ID for all other mailboxes. It could also be disabled but the customer was more satisfied with the error from a wrong device [...]

By |2011-05-17T12:04:59+01:00maj 17th, 2011|Powershell|Kommentarer lukket til Exchange and Activesync: Limiting the mailbox to sync with only one device

Technet Julekalender d. 22. december 2010 (opdateret med svar)

Technet julekalenderen er godt igang og undertegnet deltager med spørgsmålet d. 22. december. Der er masser af spændende præmier i spil og en masse interessante spørgsmål. Spørgsmålet som findes nederst i denne blog post (fra d. 22. december kl. 09:00), kan besvares fra d. 22. december, når Bjarne Dollerup har givet startskuet, dette kan følgende på hans blog eller på Twitter (@ bdollerup). Svaret skal sendes som email [email protected] Den første som svarer rigtigt bliver kontaktet, og vinderen vil denne blive annonceret på bloggen. Spørgsmålet burde kunne besvares enten fra almindelig viden, eller ved at søge lidt på min blog. [...]

By |2017-08-22T13:09:43+01:00december 21st, 2010|Powershell|2 Comments

Microsoft Scripting Games 2010

  It is almost time for the annual Scripting Games at Microsoft Scripting Guys! Scripting games is a fun “competition” with a lot of different scripting challenges. This year it is held from April, 26 – May 7. I suggest all scripters to join the fun!, it is good practice for both newcomers and hardcore scripting guys!, since there is both a basic and advanced part of the challenges! All challenges can be solved in VBScript or Powershell. This year i have been selected to make one of the expert solutions, so check out my solution at VBScript: Advanced event [...]

By |2010-04-20T12:50:29+01:00april 20th, 2010|Powershell, Scripting & Development|Kommentarer lukket til Microsoft Scripting Games 2010

Automate your group creation with Powershell

One of our very good customers are managing servers with an dedicated internal administrator as a primary contact for each server. They are managing this one to one relation with an Excel sheet. A while ago we talked about automating this group creation with powershell, so the last time Jacob and I was discussing Powershell in Operations Manager we found a solution - Jacob who is the best Danish Powershell Guru of cause did a superoptimization of my first script and now its up to you to test it on your own. Please change the first lines of the script to [...]

Powershell – WMI: Working with Shares – Part 1: Creating a Share with Custom Permissions

Download Script: [download id="12"] Intro: Last week, i was teaching a Powershell course (MOC6434), when a student asked me, how to create a share with custom permissions via WMI. I tried to find an answer for him, but could not really find any examples, cmdlets or functions for it. I found some examples and help in vbscript, so i decided to make some powershell functions of my own. I Created these functions that uses the Win32_Share class of WMI. They support remote creation and multiple permissions. New-Share is for creating a share. New-ACE is for creating one or more ACEs [...]

Powershell Acticvesync wipe

In this Powershell sample (created with ASE) - its possible to create a simple form to let Helpdesk manage Activesync Devices, this is done by finding and wipe/unwipe the device. Feel free to change and clean-up ;-) - Try ASE - http://adminscripteditor.com/ - Its a great editor. #################################################################### # Program..........: ASExWipe.ps1                            # # Author...........: Kåre Rude Andersen ([email protected])          # # Bagground........: Utility to let helpdesk manage Activesync     # # .................: devices.                                      # #################################################################### #region Script Settings #<ScriptSettings xmlns="http://tempuri.org/ScriptSettings.xsd"> #  <ScriptPackager> #    <process>powershell.exe</process> #    <arguments /> #    <extractdir>c:\scripts</extractdir> #    <files /> #    <usedefaulticon>true</usedefaulticon> #    <showinsystray>false</showinsystray> #    <altcreds>true</altcreds> #    <efs>false</efs> #    <ntfs>false</ntfs> [...]

By |2009-02-11T17:05:46+01:00februar 11th, 2009|Powershell|1 Kommentar

Usefull Powershell Links and Books.

Links: Microsoft Scripting guys! Forum: Usually you will get very quick replys and help in there http://social.technet.microsoft.com/Forums/en/ITCG/threads Powershell 2.0 and others for All Windows (Windows Management Framework) http://support.microsoft.com/default.aspx/kb/968929 Writing Help for Windows Modules http://msdn.microsoft.com/en-us/library/windows/desktop/dd878343(v=vs.85).aspx Importing / Exporting Credentials in Powershell (Manually create Credential object) http://www.leeholmes.com/blog/ImportingAndExportingCredentialsInPowerShell.aspx Working wth ODBC: http://theessentialexchange.com/blogs/michael/archive/2008/01/07/multi-platform-database-access-with-powershell.aspx Create Custom Inputbox: http://www.microsoft.com/technet/scriptcenter/resources/pstips/feb08/pstip0208.mspx Working with Arrays: http://powershell.com/cs/blogs/tips/archive/2008/11/19/working-with-arrays.aspx Change Error Message Colors: http://www.microsoft.com/technet/scriptcenter/resources/pstips/aug07/pstip0817.mspx PowerBoots - Interface for creating WPF GUI's in powershell http://huddledmasses.org/powerboots-tutorial-walkthrough/ Powershell SDK: http://www.microsoft.com/downloads/details.aspx?FamilyId=E6E1C3DF-A74F-4207-8586-711EBE331CDC&displaylang=en Free PowerShell Commands for Active Directory http://www.quest.com/powershell/activeroles-server.aspx Blog: ADPowershell: http://blogs.msdn.com/adpowershell/ Outputting Calculated Coloumns in Powershell: http://powershell.com/cs/blogs/tips/archive/2008/11/21/outputting-calculated-properties.aspx The Scripting Guys: How does the RemoteSigned execution policy [...]