TechNet
Products
IT Resources
Downloads
Training
Support
Products
Windows
Windows Server
System Center
Internet Explorer
Office
Office 365
Exchange Server
SQL Server
SharePoint Products
Lync
See all products »
Resources
Curah! curation service
Evaluation Center
Learning Resources
Microsoft Tech Companion App
Microsoft Technical Communities
Microsoft Virtual Academy
Script Center
Server and Tools Blogs
TechNet Blogs
TechNet Flash Newsletter
TechNet Gallery
TechNet Library
TechNet Magazine
TechNet Subscriptions
TechNet Video
TechNet Wiki
Windows Sysinternals
Virtual Labs
Solutions
Networking
Cloud and Datacenter
Security
Virtualization
Updates
Service Packs
Security Bulletins
Microsoft Update
Trials
Windows Server 2012 R2
System Center 2012 R2
Microsoft SQL Server 2012 SP1
Windows 8.1 Enterprise
See all trials »
Related Sites
Microsoft Download Center
TechNet Evaluation Center
Drivers
Windows Sysinternals
TechNet Gallery
Training
Training Catalog
Class Locator
Microsoft Virtual Academy
Free Windows Server 2012 courses
Free Windows 8 courses
SQL Server training
e-Learning overview
Certifications
Certification overview
MCSA: Windows 8
Windows Server Certification (MCSE)
Private Cloud Certification (MCSE)
SQL Server Certification (MCSE)
Other resources
TechNet Events
Second shot for certification
Born To Learn blog
Find technical communities in your area
Support options
For small and midsize businesses
For enterprises
For developers
For IT professionals
From partners
For technical support
Support offerings
For home users
More support
Microsoft Premier Online
Microsoft Fix It Center
TechNet Forums
MSDN Forums
Security Bulletins & Advisories
International support solutions
Log a support ticket
Not an IT pro?
Microsoft Customer Support
Microsoft Community Forums
Sign in
LeoPonti Blog
Options
RSS for posts
Atom
RSS for comments
OK
Search Blogs
Tags
2003
2008
Active Directory
ADDS
Administracion
Controllador de Dominio
DC
Directory Services
domain
domain controller
LeoPonti
Microsoft
PowerShell 3
PowerTip
Scripting Guy!
scripting techniques
Security
Technet
tool
user accounts
Weekend Scripter
Windows
Windows PowerShell
Windows Server
WORKFLOW
Archive
Archives
January 2014
(1)
September 2013
(1)
August 2013
(49)
LeoPonti Blog
TechNet Blogs
»
LeoPonti Blog
Sort by:
Most Recent
|
Most Views
|
Most Comments
Excerpt View
|
Full Post View
PowerShell Workflow for Mere Mortals: Part 5
Posted
over 1 year ago
by
LeoPonti
Summary : Microsoft Scripting Guy, Ed Wilson, concludes his five-part series about Windows PowerShell Workflow. Hey, Scripting Guy! I have a number of commands that I want to run against several remote servers. The commands include stuff that must happen prior to something else happening. But then, there are also some things that I would like to happen as fast as possible. Is this permissible? If so, do I have to write two different workflows? —TB Hello TB, Microsoft Scripting Guy, Ed Wilson, is here. This afternoon I am sipping an awesome cup of Oolong tea with a cinnamon stick, jasmine flower, and lemon grass. The flavor is just about perfect. In the background, I am listening to Ravel . Outside, the sky is dark and it is raining. The thunder seems to punctuate the music. Note This is the last post in a five-part series about Windows PowerShell Workflow for “mere mortals.” Before you read this post, please read: PowerShell Workflow for Mere Mortals: Part 1 PowerShell Workflow for Mere Mortals: Part 2 PowerShell Workflow for Mere Mortals: Part 3 PowerShell Workflow for Mere Mortals: Part 4 For more information about workflow, see these Hey, Scripting Guy! Blog posts: Windows PowerShell Workflow . Well TB, the good news is that you do not need to write two different workflows to enable parallel processing and sequential processing. Windows PowerShell Workflows are flexible enough to handle both in the same workflow. Adding a sequence activity to a workflow To add a sequence activity to a Windows PowerShell Workflow, all I need to do is use the Sequence keyword and specify a script block. When I do this, it causes the commands in the sequence script block to run sequentially and in the specified order. The key concept here is that a Sequence activity occurs within a Parallel activity. The Sequence activity is required when I want commands to run in a particular order. This is because commands running inside a Parallel activity run in an undetermined order. The commands in the Sequence script block run in parallel with all of the commands in the Parallel activity. But the commands within the Sequence script block run in the order in which they appear in the script block. The following workflow illustrates this technique: workflow get-winfeatures { Parallel { Get-WindowsFeature -Name PowerShell* InlineScript {$env:COMPUTERNAME} Sequence { Get-date $PSVersionTable.PSVersion...
PowerShell Workflow for Mere Mortals: Part 2
Posted
over 1 year ago
by
LeoPonti
Summary : Microsoft Scripting Guy, Ed Wilson, continues a five-part series about Windows PowerShell Workflow. Hey, Scripting Guy! So Windows PowerShell Workflow seems pretty cool. But I am wondering if it is possible to use it to easily provide workflow types of things for remote computers? Is this possible? —BB Hello BB, Microsoft Scripting Guy, Ed Wilson, is here. We are enjoying a cool stretch of weather here in Charlotte, North Carolina. In fact, we have the windows open. We are also enjoying our visiting friends from Hamburg, Germany. So not only do we have great weather, but we have great company. Note This is the second in a five-part series of blog posts about Windows PowerShell Workflow for “mere mortals.” You should read PowerShell Workflow for Mere Mortals: Part 1 before you read this post. For more information about workflow, see these Hey, Scripting Guy! Blog posts: Windows PowerShell Workflow . Parallel Windows PowerShell One of the reasons for using a Windows PowerShell Workflow is to be able to easily execute commands in parallel. This can result in some significant time savings. Note For an example of the time savings that are possible by using a Windows PowerShell Workflow and running commands in parallel, see the excellent post written by Windows PowerShell MVP, Niklas Goude, Use PowerShell Workflow to Ping Computers in Parallel . To perform a parallel activity by using Windows PowerShell Workflow, use the Foreach keyword with the –Parallel parameter. This is followed by the operation and the associated script block. The following script illustrates this technique: Foreach -Parallel ($cn in $computers) { Get-CimInstance -PSComputerName $cn -ClassName win32_computersystem } One of the things to keep in mind (as a major source of early frustration) is that when I call the Get-CimInstance cmdlet from within the script block of my parallel Foreach keyword, I have to use the automatically added PSComputerName parameter, not the ComputerName parameter I would normally use with the cmdlet. This is because this is the way that Windows PowerShell Workflow handles computer names. If I look at the command-line syntax for Get-CimInstance , I do not see the ––PSComputerName parameter at all. The nice thing is that if I forget to use –PSComputerName , and I try to run the Windows PowerShell Workflow, an error message appears. The message is detailed enough that it actually...
Script - Export completo de Subnets por Site en nuestro Forest
Posted
over 1 year ago
by
LeoPonti
Hola a todos! En esta oportunidad, quería dejarles un Script muy interesante, el cual nos permite exportar en pocos segundos, el detalle de las subnets que tenemos en cada uno de nuestros Site del Forest donde necesitemos tener dicho detalle...
PowerTip: Use PowerShell to Get DHCP Server Database Info
Posted
over 1 year ago
by
LeoPonti
Summary : Learn how to use Windows PowerShell to get the DHCP Server database information. How can I use Windows PowerShell to get the database information for a DHCP server if I do not know the name of the server? Use the ServerName property from the object returned by Get-DHCPServer to get the computer name, then use the Get-DhcpServerDatabase : Get-DhcpServerDatabase -ComputerName (Get-DhcpServer).ServerName Note The DHCP functions come from the DHCPServer module obtained via the RSAT tools for Windows Server 2012.
PowerTip: Use PowerShell to Display Date, Time, and Hour
Posted
over 1 year ago
by
LeoPonti
Summary : Use Windows PowerShell to display date, time, and hour in 24-hour format. How can I use Windows PowerShell to get the hour of the day in 24-hour format? Use the Get-Date cmdlet and specify the “%H” pattern to the UFormat parameter ( H is case sensitive): get-date -UFormat "%H"
PowerShell Workflow for Mere Mortals: Part 1
Posted
over 1 year ago
by
LeoPonti
Summary : Microsoft Scripting Guy, Ed Wilson, begins a five-part series about Windows PowerShell Workflow. Hey, Scripting Guy! What is up with Windows PowerShell Workflow? Everyone acts like it is some deep, dark mystery—similar to trying to understand neutrinos . So come on…it is Windows PowerShell, so how hard can it be? —MD Hello MD, Microsoft Scripting Guy, Ed Wilson, is here. This week I am going to address some questions and comments that have been collecting about Windows PowerShell Workflow. I like using Windows PowerShell Workflow because it offers a number of significant capabilities that help solve rather interesting issues. Note This is the first in a five-part series of blog posts about Windows PowerShell Workflow for “mere mortals.” For more information, see these Hey, Scripting Guy! posts about Windows PowerShell Workflow . For a conceptual introduction, see When Windows PowerShell Met Workflow . Why use workflows Windows PowerShell Workflows are cool because the commands consist of a sequence of related activities. I can use a workflow to run commands that take an extended period of time. By using a workflow, my commands can survive reboots, disconnected sessions. They can even be suspended and resumed without losing the data. This is because the workflow automatically saves state and data at the beginning and at the end of the workflow. In addition, it can use specific points that I specify. These persistence points are like checkpoints or snapshots of the activity. If a failure occurs that is unrecoverable, I can use the persisted data points, and then resume from the last data point instead of having to begin the entire process anew. Note Windows PowerShell Workflow is Windows Workflow Foundation. But instead of having to write the workflow in XAML, I can write the workflow by using Windows PowerShell syntax. I can also package the workflow in a Windows PowerShell module. For detailed documentation, see Windows Workflow Foundation . The two main reasons to use Windows PowerShell Workflow are reliability and performance when performing large scale or long-running commands. These reasons break down into the following key points: Parallel task execution Workflow throttling Connection throttling Connection pooling Integration with disconnection sessions Workflow requirements I can run a workflow that uses Windows PowerShell cmdlets if the target (the managed...
Use PowerShell to Test Remote Printers
Posted
over 1 year ago
by
LeoPonti
Summary : Learn how to use Windows PowerShell to test remote printers. Hey, Scripting Guy! I don’t know what it is, but for some reason printing still seems to be a pain. I mean, we have been using the network for a long time, and something as basic as printing still seems to be a problem. Whatever happened to the paperless office of the future? All we do is kill trees faster by using high-speed printers to print massive amounts of useless junk that no one reads. Anyway, for some reason, about half of our Help Desk calls are related to print issues. To be sure, some of it is user training issues—people trying to select the wrong feature for the wrong printer. But in all honesty, not all of the print problems are user related. For example, sometimes the print spooler seems to die, and we need to restart it. My Help Desk techs can open Computer management to stop and restart the spooler service, but I would like to do this via a script. Can you help? —RM Hello RM, Microsoft Scripting Guy, Ed Wilson, is here. We continue to get lots of rain here in Charlotte, North Carolina. Lots and lots of rain. The solar heaters for our pool are not doing much good these days. Oh well, maybe the sun will come out tomorrow. The print management module RM, you did not say if you are using Windows 8, so I am going to assume that you are. In Windows 8 (and in Surface RT, Surface Pro, and Windows Server 2012), there is a print management module called PrintManagement . It exposes the following commands: PS C:\> Get-Command -Module PrintManagement CommandType Name ModuleName ----------- ---- ---------- Function Add-Printer PrintManagement Function Add-PrinterDriver PrintManagement Function Add-PrinterPort PrintManagement Function Get-PrintConfiguration PrintManagement Function Get-Printer PrintManagement Function Get-PrinterDriver PrintManagement Function Get-PrinterPort PrintManagement Function Get-PrinterProperty PrintManagement Function Get-PrintJob PrintManagement Function Remove-Printer PrintManagement Function Remove-PrinterDriver PrintManagement Function Remove-PrinterPort PrintManagement Function Remove-PrintJob PrintManagement Function Rename-Printer PrintManagement Function Restart-PrintJob PrintManagement Function Resume-PrintJob PrintManagement Function Set-PrintConfiguration PrintManagement Function Set-Printer PrintManagement Function Set-PrinterProperty PrintManagement...
PowerTip: Display All PowerShell Modules and Cmdlets
Posted
over 1 year ago
by
LeoPonti
Summary : Learn how to display all Windows PowerShell modules and cmdlet names. How can I get output that shows Windows PowerShell module names and the cmdlets or functions that are contained inside the modules? Use the Get-Module cmdlet, and then for each module, display the name and use Get-Command ( gcm is an alias) to retrieve the cmdlets and functions (this is a single-line command broken at the pipe character for readability): Get-Module -ListAvailable | foreach {"`r`nmodule name: $_"; "`r`n";gcm -Module $_.name -CommandType cmdlet, function | select name}
WikiNinjas Blog: Semana del 12/8 al 19/8
Posted
over 1 year ago
by
LeoPonti
2
Comments
Hola a todos! En esta oportunidad, les dejo los artículos que fueron publicados en la semana del 12/8 al 19/8 en el blog de TechNet WikiNinjas 19/8 Interview with a Wiki Ninja and SharePoint Guru - Matthew Yarlett Por Ed Price 19/8 July...
PowerTip: Find PowerShell Logging Info
Posted
over 1 year ago
by
LeoPonti
Summary : Use a Windows PowerShell cmdlet to retrieve logged information about Windows PowerShell. How can I easily find logged information about Windows PowerShell? Use the Get-WinEvent cmdlet and look for a LogName with powershell in the name: Get-WinEvent -LogName *powershell*
PowerTip: Use PowerShell to Report Network Adapter Binding
Posted
over 1 year ago
by
LeoPonti
Summary : Use Windows PowerShell 3.0 in Windows 8 to view network adapter binding information. How can I use Windows PowerShell 3.0 in Windows 8 to review network adapter binding information? Use the Get-NetAdapterBinding function and pipe the resulting information to the Format-List cmdlet: Get-NetAdapterBinding | Format-List *
Adding Office Locations in AD DS with PowerShell
Posted
over 1 year ago
by
LeoPonti
Summary : Microsoft Scripting Guy, Ed Wilson, talks about using Windows PowerShell to add office locations in Active Directory Domain Services. Hey, Scripting Guy! We are in the midst of a domain migration at work, and I need to clean up a number of attributes in Active Directory prior to our migration. Part of our issue is that we have attributes that are missing values, and I just hate to migrate empty stuff. Is there anything you can do to help? —TV Hello TV, Microsoft Scripting Guy, Ed Wilson, is here. I am listening to my customized Internet radio station with a cool app I found for Windows 8 in the Windows Store. It is really cool to be able to select my listening preferences. I have actually spent a bit of time and created a couple of special Scripting Guy stations. It all depends on what I am writing. For example, Active Directory Domain Services questions simply beg for a bit of classic New Orleans style jazz —or, that is just me. Jazz also goes well with spearmint, wintergreen, peppermint, and lemon grass with a spoon full of Gun Powder Green tea. So I have my tunes and my tea. I guess I will answer your question. First find the attribute The first thing I need to do is to find the attribute that is missing. I first look at the user in Active Directory Users and Computers. This is shown here: It seems that the Office attribute is missing from all of the user objects. I add a bunch of AAAAAs to the Office field so I can find the attribute in ADSI Edit. I check with ADSI Edit, and sure enough the Office attribute is named physicalDeliveryOfficeName as shown in the following image. Good, that makes it easy. I look around, and all of the cities are populated. So I check ADSI Edit, and I figure out that it uses a lower-case l — as in L for Location. This is shown here. Populating the Office field In my example, the office names are the same as the city names. So all I need to do is to read all of the city names from all users in the TestOU organizational unit and add the city value to the Office attribute. First, let me make sure I can get the cities for all users. This is shown here: Get-ADUser -Filter * -SearchBase 'ou=testou,dc=iammred,dc=net' -Properties l The command and its output are shown in the image that follows. As it turns out, I do not need to know the physicalDeliveryOfficeName attribute name because Set-ADUser has an –Office parameter. I compose the following command...
PowerTip: Use PowerShell to Get DHCP Stats
Posted
over 1 year ago
by
LeoPonti
Summary : Learn how to use Windows PowerShell 3.0 in Windows Server 2012 to get DHCP statistics. How can I get an overview from my DHCP server running on Windows Server 2012? Use the Get-DHCPServerv4Statistics function: Get-DhcpServerv4Statistics -ComputerName DHCP1
Weekend Scripter: Understanding PowerShell in Windows 7
Posted
over 1 year ago
by
LeoPonti
Summary : Microsoft Scripting Guy, Ed Wilson, talks about understanding Windows PowerShell in Windows 7. Microsoft Scripting Guy, Ed Wilson, is here. This morning I am sipping a cup of English Breakfast tea, with goji berries , lemon grass, and cinnamon. The taste is quite nice, and because the goji berries are sweet, I do not need to add any sugar or honey to my tea. Goji berries are not indigenous to Charlotte, North Carolina, so I use dried berries that I order with my other herbs and spices. Along with my tea, I am eating some homemade scones that the Scripting Wife made with the goji berries. They are rather lovely. One of the more common questions I get about Windows PowerShell 3.0 runs something like this,“I have Windows PowerShell 3.0, but I do not see the Get-Disk cmdlet.” (Or words to that effect.) Part of the confusion stems from confusing Windows PowerShell 3.0 with the operating system. Note For information about installation, refer to Install PowerShell 3.0 on Windows 7 . For example, in Windows 7, when I install Windows PowerShell 3.0, I have access to 355 cmdlets and functions. To find this information, I first imported all of the modules, and then I used the Get-Command cmdlet to retrieve all functions and cmdlets. This is shown here: In Windows 8, I do not need to install Windows PowerShell 3.0 because it is part of the operating system. When I import all of the modules and count the number of cmdlets and functions in Windows 8, I come up with 988. The output is shown in the following image. Note Interestingly enough, the output from $PSVersionTable is a little different in Windows 7 and Windows 8. Look at the modules So, where does the difference between Windows PowerShell 3.0 in Windows 7 and In Windows 8 come from? Well, it comes from the modules. In Windows 8, many of the teams at Microsoft created modules to permit remote management of aspects of their configuration. In many cases, this took the form of wrapping various WMI classes that have been part of the operating system for a long time. Therefore, just because I am working in Windows 7, it does not mean that I am unable to use Windows PowerShell to manage it—but it will be a bit more difficult. So what are the modules that are available in Windows 7 after I install Windows PowerShell 3.0? They are listed here: PS C:\> Get-Module -list | select name Name ---- AppLocker BitsTransfer CimCmdlets ISE Microsoft...
Use PowerShell to Customize Server Manager
Posted
over 1 year ago
by
LeoPonti
Summary : Guest blogger, Rolf Masuch, talks about using Windows PowerShell to customize Server Manager. Microsoft Scripting Guy, Ed Wilson, is here. Today we have a guest post written by Rolf Masuch, who is a senior consultant for Microsoft in Germany. Today is Rolf’s birthday, and he wanted to start the celebration off right by sharing a couple of cool scripts with us. Take it away Rolf… When it comes to the new versions of Windows Server 2012 R2 and Windows Server 2012, one of my most-loved changes is to Server Manager. The new Server Manager Dashboard looks like this: Lots of documents have been written already about this new way of working. Today I’d like to share two extension scripts that I thought would be helpful for the community because when it comes to automating Server Manager, you cannot do two things: Add servers to your list of managed servers Create groups that contain a custom list of servers You will find the respective menu entries in Server Manager when you click Manage . But first, let’s look behind the curtain of Server Manager. It stores information in an XML file that is saved per user at this location: $ENV:APPDATA\Microsoft\Windows\ServerManager\ServerList.xml Additionally, it is useful to know that every time you close a running Server Manager instance, it can overwrite your scripted changes. We want to take care that before we make changes to the XML file, we close the Server Manager process. We also need to make all changes in an elevated process. When it comes down to writing additional entries to the file, you may think, “Hey, it is just XML, this is easy.” But when you look at the structure of the XML file, you see that this is not so simple. The following example is from a freshly installed system with one additional group: ServerManager.xml *** <?xml version="1.0" encoding="utf-8"?> <ServerList xmlns:xsd=" http://www.w3.org/2001/XMLSchema " xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance " localhostName="MyCloudComp001" xmlns="urn:serverpool-schema"> <ServerInfo name="MyCloudComp001" status="1" lastUpdateTime="2013-08-08T09:01:26.7659233+00:00" locale="en-US" /><ServerGroupInfo id="3" name="MyGroup" /> <ServerGroupMembership server="MyCloudComp001" serverGroupId="3" /> </ServerList> *** As you see from the initial lines, the XML structure is using an additional namespace that is...
Use PowerShell in Windows 8 to Remove Printers
Posted
over 1 year ago
by
LeoPonti
Summary : Microsoft Scripting Guy, Ed Wilson, talks about using Windows PowerShell 3.0 in Windows 8 to remove printers. Microsoft Scripting Guy, Ed Wilson, is here. The Scripting Wife and I have been talking to various people from the Charlotte Windows PowerShell User Group all week about doing another Windows PowerShell Saturday. It is an awful lot of work, but I think we are going to do this again. The Windows PowerShell Saturday in Charlotte sold out within a few days, and there have been many positive comments about the event. That means that people found it to be a valuable experience. So we will have another Windows PowerShell Saturday. (By the way, if you want to have one where you live, let us know via scripter@microsoft.com .) To remove a printer with Windows PowerShell, I use the Remove-Printer function from the PrinterManagement module. There are two ways to use the Remove-Printer function: Remove-Printer [-Name] <String> [-AsJob [<SwitchParameter>]] [-CimSession <CimSession>] [-ComputerName <String>] [-PassThru [<SwitchParameter>]] [-ThrottleLimit <Int32>] [-Confirm [<SwitchParameter>]] [-WhatIf [<SwitchParameter>]] [<CommonParameters>] Remove-Printer [-AsJob [<SwitchParameter>]] [-CimSession <CimSession>] [-PassThru [<SwitchParameter>]] [-ThrottleLimit <Int32>] -InputObject <CimInstance> [-Confirm [<SwitchParameter>]] [-WhatIf [<SwitchParameter>]] [<CommonParameters>] What this means is that if I type the exact printer name, I can use the Remove-Printer function directly. It also tells me that I can pipe a printer object to the function. By pipelining a printer object, I can use wildcard characters. Begin with Get-Printer I usually begin things by using a Get type of command. So the first thing I do is use the Get-Printer function to see what printers are defined. The command is shown here: Get-Printer The command and its associated output are shown here: I can use a wildcard character to avoid typing a complete printer name as shown here: PS C:\> Get-Printer | where name -Like "my*" Name ComputerName Type DriverName ---- ------------ ---- ---------- myotherlaser Local Brother Laser Leg Typ... Or, I can type the exact printer name and supply it directly to the –Name parameter as shown here: PS C:\> Get-Printer -Name myotherlaser Name ComputerName Type DriverName...
PowerTip: Change PowerShell Script Execution Policy
Posted
over 1 year ago
by
LeoPonti
Summary : Learn how a user can change the Windows PowerShell script execution policy. How can I change the Windows PowerShell script execution policy as simply an ordinary user? Use the –Scope parameter with the Set-ExecutionPolicy cmdlet and specify CurrentUser (the –Force parameter hides prompts from the cmdlet): Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser -Force
PowerTip: Customize How PowerShell Displays a Date
Posted
over 1 year ago
by
LeoPonti
Summary : Easily customize the way Windows PowerShell displays a date. How can I use Windows PowerShell to easily display the date as day-dash-month-dash-four-digit year? Use the Get-Date cmdlet,specify a custom format by using the Format parameter, and use dd for the date, M for the month and yyyy for a four-digit year (this is case sensitive): Get-Date -Format "dd-M-yyyy"
PowerTip: Use PowerShell to Show Approved Verbs Group
Posted
over 1 year ago
by
LeoPonti
Summary : Use Windows PowerShell to show the group of approved Windows PowerShell verbs. How can I find the grouping information for a couple of approved verbs that I want to use to name my advanced functions? Use the Get-Verb function, and supply an array of verbs to the function: get-verb ping, receive
PowerTip: View PowerShell Console Host Information
Posted
over 1 year ago
by
LeoPonti
Summary : View Windows PowerShell console host information. How can I easily find information about the Windows PowerShell console host? Use the Get-Host cmdlet, and select the RawUI property from the InterhostUserInterface object: (get-host).ui.RawUI
Weekend Scripter: Run PowerShell Scripts from Remote File Share: Part 2
Posted
over 1 year ago
by
LeoPonti
Weekend Scripter: Run PowerShell Scripts from Remote File Share: Part 2 Summary : Microsoft Scripting Guy, Ed Wilson, continues his discussion about running scripts on a remote file share. Microsoft Scripting Guy, Ed Wilson, is here. This week has been absolutely bizarre. I have been really busy working with a select group of Honorary Scripting Guys for upcoming blog posts. I must say, there is some absolutely way cool, knock-out stuff in the works. But of course, to make all of this streamlined, I had to set up a shared Office 365 SharePoint site, grant permissions, create views, test things out, and all of that. You know what? Dude, it was easy!!! As you may guess from the three exclamation points, I was surprised. I must say that I was dreading it. I will also say that it was so intuitive that I did not once have to use Help or search for How-To articles. It really makes sense, and it has actually been a fun project. As one twentieth-century philosopher said, “I love it when a plan comes together.” Examining script execution policy Note This is the second in a multipart series of posts. The first post was Running Scripts from a Remote File Share . For good background info about running Windows PowerShell scripts from a remote file share, check out the guest blog post written by June Blender and Judith Herman: How to Run PowerShell Scripts from a Shared Directory . By default when you open Windows PowerShell, the execution of scripts is disabled. This is because the default script execution policy in Windows PowerShell is restricted. To see the current script execution policy, use the Get-ExecutionPolicy cmdlet. For the current user, all you need to do is type the cmdlet name. This is shown here: PS C:\> Get-ExecutionPolicy RemoteSigned To see all of the execution policies, use the –List switch as shown here: PS C:\> Get-ExecutionPolicy -List Scope ExecutionPolicy ----- --------------- MachinePolicy Undefined UserPolicy Undefined Process Undefined CurrentUser RemoteSigned LocalMachine Unrestricted You can see that there are multiple levels to which the script execution policy can be set. An ordinary user can change the CurrentUser script execution policy (unless it is specified via Group Policy. In that case, it cannot be modified by a local user). When the execution policy is first checked, it is restricted; therefore, no scripts will run. In the following example, the execution...
PowerTip: Use PowerShell to Verify Secure Boot Policy
Posted
over 1 year ago
by
LeoPonti
Summary : Use Windows PowerShell to verify your Secure Boot policy in Windows 8. How can I verify that the Secure Boot policy is enabled in my computers running Windows 8? Use the Get-SecureBootPolicy cmdlet: Get-SecureBootPolicy
PowerTip: Use PowerShell to Display Help for Module Cmdlets
Posted
over 1 year ago
by
LeoPonti
Summary : Use Windows PowerShell to display all Help for all cmdlets in a module. How can I see all of the Help examples for cmdlets from a specific module? After you have updated your Help in Windows PowerShell 3.0, use the Get-Command cmdlet to retrieve all cmdlets from a specific module, pipe the results to the Foreach-Object cmdlet, and use the Get-Help cmdlet inside the script block. Following is an example for the PrintManagement module: Get-Command -Module PrintManagement| Foreach-Object {get-help $_.name -Examples} Here is a shorter version of the same command: gcm -mo *print* | % {get-help $_.name -ex}
PowerTip: Find Case-Specific Strings by Using PowerShell
Posted
over 1 year ago
by
LeoPonti
Summary : Use Windows PowerShell to find case-specific strings. How can I find a particular, case-sensitive word in a string? Use Select-String and specify the –CaseSensitive switch: "Hey Scripting Guy","hey scripting guy" | Select-String -Pattern 'hey' -CaseSensitive
PowerTip: Use PowerShell to Display Replications in AD DS
Posted
over 1 year ago
by
LeoPonti
Summary : Use Windows PowerShell to display replication connections in Active Directory Domain Services. How can I use a cmdlet from the Active Directory module to display replication connections in AD DS? Use the Get-ADReplicationConnection cmdlet and select the ReplicateFromDirectoryServer property and the ReplicateToDirectoryServer property (this is a single-line command broken at the pipe character for readability): Get-ADReplicationConnection | select ReplicateFromDirectoryServer, ReplicateToDirectoryServer
<
>