Powershell ISE bugs?
Using PowerShell 3.0 ISE on Windows Server 2008 R2 with the latest service pack. Copy and paste within a PowerShell ISE window or between windows or from the ISE to anything else only works intermittently. There is no other copy and past problem on the servers.
Also when I modify a PS script and run it Powershell often runs the previous version of the script. Some times I have to save AND close AND reopen to get the revised script instead of the original script to run.
Is this just my servers?
carpe cras
There is a Connect issue reported for Cut, probably could roll this one up into this by adding a comment and voting on it. If you don't think it is related enough, you can always open up a new Connect item as well.
https://connect.microsoft.com/PowerShell/feedback/details/777187/ctrl-x-cut-keyboard-shortcut-stops-working-in-powershell-ise-after-a-while
Boe Prox
Blog |
PoshWSUS | PoshPAIG |
PoshChat
Similar Messages
-
Powershell ISE – change indent/tab size + keep tabs
Anyway to change indent/tab size in Powershell ISE?
Something simple like in Visual studio IDE:
Tab size 2
Indent size 2
Keep tabsFigured I'd share the changes I made to NoSimDash's above code. I actually wrote this not long after he posted his reply, but decided not to post it after I settled on taking the cheap, hacky timer route. (Originally I was looking to have the process triggered
by an event when the user changed tabs)
Anyways, over the last two years it's been pretty stable, so I thought I'd share on the off-chance that someone goes looking for this functionality again.
$psISE.Options.ShowOutlining = $true
$psISE.Options.ShowDefaultSnippets = $true
$psISE.Options.ShowIntellisenseInScriptPane = $true
$psISE.Options.ShowIntellisenseInConsolePane = $true
Set-Variable -Option AllScope -Name OptionSetter -Value (&{
$ClassName = 'IndentFixer'
$Namespace = 'ISEHijack'
Add-Type @"
internal class _Option<TValue>
public _Option(string key, TValue value)
Key = key;
Value = value;
public Object[] Params { get { return new object[] { Key, Value }; } }
public string Key { get; private set; }
public TValue Value { get; private set; }
internal static object[] Opt<TVal>(string key, TVal value)
return new _Option<TVal>(key, value).Params;
internal static readonly object[][] NewOpts = {
Opt<bool>("Adornments/HighlightCurrentLine/Enable", false),
Opt<int>("Tabs/TabSize", 4),
Opt<int>("Tabs/IndentSize", 4),
Opt<bool>("Tabs/ConvertTabsToSpaces", false),
Opt<bool>("TextView/UseVirtualSpace", false),
Opt<bool>("TextView/UseVisibleWhitespace", true)
internal void SetOpts()
foreach(object[] args in NewOpts) {
Setter.Invoke(Options, args);
public MethodInfo Setter { get; set; }
public object Options { get; set; }
public Dispatcher EditorDispatcher { get; set; }
public List<Action> Actions { get; private set; }
public ${ClassName}()
Actions = new List<Action>();
Actions.Add(SetOpts);
public void Dispatch(Dispatcher dispatcher)
DispatcherFrame frame = new DispatcherFrame();
dispatcher.BeginInvoke(DispatcherPriority.Normal, new DispatcherOperationCallback(ExitFrames), frame);
Dispatcher.PushFrame(frame);
private object ExitFrames(object f){
DispatcherFrame frame = ((DispatcherFrame)f);
// foreach(Action action in Actions) {
// action.Invoke();
// Actions.Clear();
foreach(object[] args in NewOpts) {
Setter.Invoke(Options, args);
frame.Continue = false;
return null;
"@ -Name $ClassName `
-NameSpace $Namespace `
-UsingNamespace System.Windows.Forms,System.Windows.Threading,System.Reflection,Microsoft.VisualStudio.Text.EditorOptions.Implementation,System.Collections.Generic `
-ReferencedAssemblies WindowsBase,System.Windows.Forms,Microsoft.PowerShell.Editor
return `
"${Namespace}.${ClassName}" |
Add-Member -Type NoteProperty -Name Namespace -Value $Namespace -Passthru |
Add-Member -Type NoteProperty -Name ClassName -Value $ClassName -Passthru
[System.Reflection.BindingFlags] $NonPublicFlags = [System.Reflection.BindingFlags] 'NonPublic,Instance'
filter Expand-Property
PARAM(
[Alias('Property')]
[ValidateNotNullOrEmpty()]
[Parameter(Mandatory, Position=0)]
[String] $Name
$_ | Select-Object -ExpandProperty $Name | Write-Output
function Get-IsePrefs
PARAM(
[Parameter(Mandatory, Position=1)]
[ValidateNotNullOrEmpty()]
[string] $Key
$oEditor = $psISE.CurrentFile.Editor
$tEditor = $oEditor.GetType()
$tEditor.GetProperty('EditorOperations', $NonPublicFlags).GetMethod.Invoke($oEditor, $null).Options | `
Expand-Property GlobalOptions | `
Expand-Property SupportedOptions | `
Select-Object -Property Key,ValueType,DefaultValue | `
Write-Output
function Comment-Selection
$output = ''
$psISE.CurrentFile.Editor.SelectedText.Split("`n") | ForEach-Object -Process { $output += "# " + [string]$_ + "`n" }
$psISE.CurrentFile.Editor.InsertText($output)
function Fix-EditorIndentation
PARAM(
[Alias('ISEEditor')][ValidateNotNull()]
[Parameter(Mandatory, ValueFromPipeline, Position=1)]
[Microsoft.PowerShell.Host.ISE.ISEEditor]
$Editor
$EditorType = $Editor.GetType()
$SetterInstance = New-Object -TypeName $OptionSetter
$SetterInstance.Options = $EditorType.GetProperty('EditorOperations', $NonPublicFlags).GetMethod.Invoke($Editor, $null).Options
$Dispatcher = $EditorType.GetProperty('EditorViewHost', $NonPublicFlags).GetMethod.Invoke($Editor, $null).Dispatcher
$SetterInstance.Setter = $SetterInstance.Options.GetType().GetMethod('SetOptionValue', [type[]]@([string],[object]))
$SetterInstance.Dispatch($Dispatcher)
function Fix-IseIndentation
[Microsoft.Windows.PowerShell.Gui.Internal.MainWindow] $ISEWindow = (Get-Host | Select-Object -ExpandProperty PrivateData | Select-Object -ExpandProperty Window)
[Microsoft.Windows.PowerShell.Gui.Internal.RunspaceTabControl] $RSTabCtrl = $ISEWindow.Content[0].Children[2]
[Microsoft.PowerShell.Host.ISE.PowerShellTab] $PSTab = $RSTabCtrl.Items[0]
$PSTab.Files | Select-Object -ExpandProperty Editor | Fix-EditorIndentation
function Invoke-ISEFunction
PARAM(
[Parameter(Mandatory, Position=1)]
[Action] $ScriptBlock
$ISEWindow = $(Get-Host | Select-Object -ExpandProperty PrivateData | Select-Object -ExpandProperty Window)
return $ISEWindow.Dispatcher.Invoke($ScriptBlock)
function Fix-IndentationForAll
$psISE.PowerShellTabs | Select-Object -ExpandProperty 'Files' | Select-Object -ExpandProperty 'Editor' | Fix-EditorIndentation
# Startup
function New-Timer
PARAM(
[Alias('Handler')]
[Parameter(Position=0, Mandatory=$true)]
$Action,
[Double]
[Parameter(Mandatory=$false)]
$Interval = 50,
[Boolean]
[Parameter(Mandatory=$false)]
$AutoReset = $true
[System.Timers.Timer] $oTimer = New-Object -TypeName System.Timers.Timer($Interval)
$ElapsedEvent = Register-ObjectEvent -InputObject $oTimer -EventName 'Elapsed' -Action $Action
$oTimer.AutoReset = $AutoReset
return $oTimer
$(New-Timer {
Fix-IndentationForAll
} -Interval 100 -AutoReset $true).Start() -
Using PowerShell ISE on Exchange Edge Server
I need manage edge servers from PowerShell ISE to create a script. I tried the steps mentioned on TechNet, but they give an error due to Kerberos not being usable on a workgroup computer.
Any ideas how I can manage to do this without much tinkering?
TechNet Article that doesn't work with Edge server:
http://technet.microsoft.com/en-us/library/dd335083(v=exchg.150).aspxHi,
According to the description, I notice that you are using workgroup computer.
If you are using workgroup computer, based on my knowledge, it seems impossible to apply Edge settings.
If you have Script requirement, I suggest ask Script Center for help, so that you can get more professional suggestions. For your convenience:
http://technet.microsoft.com/en-us/scriptcenter/dd742246.aspx
Thanks
Mavis Huang
TechNet Community Support -
Hi,
Im having some issue with a few powershell workflow scripts that will work in powershell ISE but they will appear to not run in a Admin powershell command prompt session.
The script is simple.
Workflow NewUser
Param (
[Parameter(Mandatory=$True)]
[string] $givenname,
[Parameter(Mandatory=$True)]
[string] $surname,
[Parameter(Mandatory=$True)]
[string] $template
"Param1 = $givenname"
"Param2 = $surname"
"Param3 = $template"
The saved file name is NewUser.ps1.
When I run .\NewUser.ps1 -givenname test -surname test -template test
Nothing happens. In Powershell ISE, it outputs
Param1 = test
Param2 = test
Template = test
I can run .\NewUser.ps1 skdjfsdkfjsdkfjsdkfj in powershell command
and nothing happens.
I notice this behavior with a number of scripts that I get working with ISE and they dont work in powershell command prompt.
We are using Powershell 4.0
Thanks LanceWhen I run
Set-psdebug -step
then newuser.ps1 -givename test -surname test -template test
it gets to the line workflow newuser and quits
am I missing some dependency?
Running [System.Threading.Thread]::GetDomain().GetAssemblies() in powershell commmand returns the following.
GAC Version Location
True v4.0.30319 C:\Windows\Microsoft.NET\Framework64\v4.0.30319\mscorlib.dll
True v4.0.30319 C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Microsoft.PowerShell.ConsoleHost\v4.0_3.0.0.0__31bf...
True v4.0.30319 C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System\v4.0_4.0.0.0__b77a5c561934e089\System.dll
True v4.0.30319 C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Core\v4.0_4.0.0.0__b77a5c561934e089\System.C...
True v4.0.30319 C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Management.Automation\v4.0_3.0.0.0__31bf3856...
True v4.0.30319 C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Numerics\v4.0_4.0.0.0__b77a5c561934e089\Syst...
True v4.0.30319 C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Xml\v4.0_4.0.0.0__b77a5c561934e089\System.Xm...
True v4.0.30319 C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.DirectoryServices\v4.0_4.0.0.0__b03f5f7f11d5...
True v4.0.30319 C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Management\v4.0_4.0.0.0__b03f5f7f11d50a3a\Sy...
True v4.0.30319 C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Microsoft.Management.Infrastructure\v4.0_1.0.0.0__3...
False v4.0.30319
True v4.0.30319 C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Configuration.Install\v4.0_4.0.0.0__b03f5f7f...
True v4.0.30319 C:\Windows\Microsoft.Net\assembly\GAC_64\System.Transactions\v4.0_4.0.0.0__b77a5c561934e089\Sy...
True v4.0.30319 C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Microsoft.PowerShell.Security\v4.0_3.0.0.0__31bf385...
True v4.0.30319 C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Configuration\v4.0_4.0.0.0__b03f5f7f11d50a3a...
True v4.0.30319 C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Microsoft.PowerShell.Activities\v4.0_3.0.0.0__31bf3...
True v4.0.30319 C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Activities\v4.0_4.0.0.0__31bf3856ad364e35\Sy...
True v4.0.30319 C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Microsoft.PowerShell.Workflow.ServiceCore\v4.0_3.0....
True v4.0.30319 C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Activities.Presentation\v4.0_4.0.0.0__31bf38...
True v4.0.30319 C:\Windows\Microsoft.Net\assembly\GAC_MSIL\PresentationFramework\v4.0_4.0.0.0__31bf3856ad364e3...
True v4.0.30319 C:\Windows\Microsoft.Net\assembly\GAC_MSIL\WindowsBase\v4.0_4.0.0.0__31bf3856ad364e35\WindowsB...
True v4.0.30319 C:\Windows\Microsoft.Net\assembly\GAC_64\PresentationCore\v4.0_4.0.0.0__31bf3856ad364e35\Prese...
True v4.0.30319 C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Xaml\v4.0_4.0.0.0__b77a5c561934e089\System.X...
True v4.0.30319 C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Microsoft.PowerShell.Core.Activities\v4.0_3.0.0.0__...
True v4.0.30319 C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Microsoft.PowerShell.Diagnostics.Activities\v4.0_3....
True v4.0.30319 C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Microsoft.PowerShell.Management.Activities\v4.0_3.0...
True v4.0.30319 C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Microsoft.PowerShell.Security.Activities\v4.0_3.0.0...
True v4.0.30319 C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Microsoft.PowerShell.Utility.Activities\v4.0_3.0.0....
True v4.0.30319 C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Microsoft.WSMan.Management.Activities\v4.0_3.0.0.0_...
True v4.0.30319 C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Runtime.DurableInstancing\v4.0_4.0.0.0__31bf...
True v4.0.30319 C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.ServiceModel.Internals\v4.0_4.0.0.0__31bf385...
True v4.0.30319 C:\Windows\Microsoft.Net\assembly\GAC_64\System.Data\v4.0_4.0.0.0__b77a5c561934e089\System.Dat...
True v4.0.30319 C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Microsoft.PowerShell.Commands.Utility\v4.0_3.0.0.0_...
True v4.0.30319 C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Xml.Linq\v4.0_4.0.0.0__b77a5c561934e089\Syst...
True v4.0.30319 C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Microsoft.CSharp\v4.0_4.0.0.0__b03f5f7f11d50a3a\Mic...
True v4.0.30319 C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Microsoft.PowerShell.Commands.Management\v4.0_3.0.0...
True v4.0.30319 C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Dynamic\v4.0_4.0.0.0__b03f5f7f11d50a3a\Syste...
and for the ISE it returns this
GAC Version Location
True v4.0.30319 C:\Windows\Microsoft.NET\Framework64\v4.0.30319\mscorlib.dll
False v4.0.30319 C:\Windows\System32\WindowsPowerShell\v1.0\powershell_ise.exe
True v4.0.30319 C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Microsoft.PowerShell.ISECommon\v4.0_3.0.0.0__31bf3856ad364e35\Mic...
True v4.0.30319 C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System\v4.0_4.0.0.0__b77a5c561934e089\System.dll
True v4.0.30319 C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Windows.Forms\v4.0_4.0.0.0__b77a5c561934e089\System.Window...
True v4.0.30319 C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Drawing\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Drawing.dll
True v4.0.30319 C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Management.Automation\v4.0_3.0.0.0__31bf3856ad364e35\Syste...
True v4.0.30319 C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Core\v4.0_4.0.0.0__b77a5c561934e089\System.Core.dll
True v4.0.30319 C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Microsoft.PowerShell.GPowerShell\v4.0_3.0.0.0__31bf3856ad364e35\M...
True v4.0.30319 C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.ComponentModel.Composition\v4.0_4.0.0.0__b77a5c561934e089\...
True v4.0.30319 C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Microsoft.PowerShell.Editor\v4.0_3.0.0.0__31bf3856ad364e35\Micros...
True v4.0.30319 C:\Windows\Microsoft.Net\assembly\GAC_MSIL\PresentationFramework\v4.0_4.0.0.0__31bf3856ad364e35\Presentation...
True v4.0.30319 C:\Windows\Microsoft.Net\assembly\GAC_MSIL\WindowsBase\v4.0_4.0.0.0__31bf3856ad364e35\WindowsBase.dll
True v4.0.30319 C:\Windows\Microsoft.Net\assembly\GAC_64\PresentationCore\v4.0_4.0.0.0__31bf3856ad364e35\PresentationCore.dll
True v4.0.30319 C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Xaml\v4.0_4.0.0.0__b77a5c561934e089\System.Xaml.dll
True v4.0.30319 C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Configuration\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Config...
True v4.0.30319 C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Xml\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.dll
True v4.0.30319 C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Runtime.Serialization\v4.0_4.0.0.0__b77a5c561934e089\Syste...
True v4.0.30319 C:\Windows\Microsoft.Net\assembly\GAC_MSIL\UIAutomationProvider\v4.0_4.0.0.0__31bf3856ad364e35\UIAutomationP...
True v4.0.30319 C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Accessibility\v4.0_4.0.0.0__b03f5f7f11d50a3a\Accessibility.dll
False v4.0.30319
True v4.0.30319 C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.DirectoryServices\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Di...
True v4.0.30319 C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Management\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Managemen...
True v4.0.30319 C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Microsoft.Management.Infrastructure\v4.0_1.0.0.0__31bf3856ad364e3...
True v4.0.30319 C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Numerics\v4.0_4.0.0.0__b77a5c561934e089\System.Numerics.dll
False v4.0.30319
True v4.0.30319 C:\Windows\Microsoft.Net\assembly\GAC_MSIL\PresentationFramework.AeroLite\v4.0_4.0.0.0__31bf3856ad364e35\Pre...
True v4.0.30319 C:\Windows\Microsoft.Net\assembly\GAC_MSIL\UIAutomationTypes\v4.0_4.0.0.0__31bf3856ad364e35\UIAutomationType...
True v4.0.30319 C:\Windows\Microsoft.Net\assembly\GAC_MSIL\PresentationFramework-SystemXml\v4.0_4.0.0.0__b77a5c561934e089\Pr...
True v4.0.30319 C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Configuration.Install\v4.0_4.0.0.0__b03f5f7f11d50a3a\Syste...
True v4.0.30319 C:\Windows\Microsoft.Net\assembly\GAC_64\System.Transactions\v4.0_4.0.0.0__b77a5c561934e089\System.Transacti...
True v4.0.30319 C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Microsoft.PowerShell.Security\v4.0_3.0.0.0__31bf3856ad364e35\Micr...
False v4.0.30319
True v4.0.30319 C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Microsoft.PowerShell.GraphicalHost\v4.0_3.0.0.0__31bf3856ad364e35...
False v4.0.30319
True v4.0.30319 C:\Windows\Microsoft.Net\assembly\GAC_MSIL\PresentationFramework-SystemCore\v4.0_4.0.0.0__b77a5c561934e089\P...
True v4.0.30319 C:\Windows\Microsoft.Net\assembly\GAC_64\System.Data\v4.0_4.0.0.0__b77a5c561934e089\System.Data.dll
True v4.0.30319 C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Microsoft.PowerShell.Commands.Utility\v4.0_3.0.0.0__31bf3856ad364...
True v4.0.30319 C:\Windows\Microsoft.Net\assembly\GAC_MSIL\PresentationFramework-SystemData\v4.0_4.0.0.0__b77a5c561934e089\P...
True v4.0.30319 C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Microsoft.PowerShell.Commands.Management\v4.0_3.0.0.0__31bf3856ad...
True v4.0.30319 C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.ServiceProcess\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Servi...
True v4.0.30319 C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Microsoft.CSharp\v4.0_4.0.0.0__b03f5f7f11d50a3a\Microsoft.CSharp.dll
True v4.0.30319 C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Microsoft.PowerShell.Activities\v4.0_3.0.0.0__31bf3856ad364e35\Mi...
True v4.0.30319 C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Activities\v4.0_4.0.0.0__31bf3856ad364e35\System.Activitie...
True v4.0.30319 C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Microsoft.PowerShell.Workflow.ServiceCore\v4.0_3.0.0.0__31bf3856a...
True v4.0.30319 C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Activities.Presentation\v4.0_4.0.0.0__31bf3856ad364e35\Sys...
True v4.0.30319 C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Microsoft.PowerShell.Core.Activities\v4.0_3.0.0.0__31bf3856ad364e...
True v4.0.30319 C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Microsoft.PowerShell.Diagnostics.Activities\v4.0_3.0.0.0__31bf385...
True v4.0.30319 C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Microsoft.PowerShell.Management.Activities\v4.0_3.0.0.0__31bf3856...
True v4.0.30319 C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Microsoft.PowerShell.Security.Activities\v4.0_3.0.0.0__31bf3856ad...
True v4.0.30319 C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Microsoft.PowerShell.Utility.Activities\v4.0_3.0.0.0__31bf3856ad3...
True v4.0.30319 C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Microsoft.WSMan.Management.Activities\v4.0_3.0.0.0__31bf3856ad364...
True v4.0.30319 C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Runtime.DurableInstancing\v4.0_4.0.0.0__31bf3856ad364e35\S...
True v4.0.30319 C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.ServiceModel.Internals\v4.0_4.0.0.0__31bf3856ad364e35\Syst...
True v4.0.30319 C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Xml.Linq\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.Linq.dll
True v4.0.30319 C:\Windows\Microsoft.Net\assembly\GAC_MSIL\PresentationFramework-SystemXmlLinq\v4.0_4.0.0.0__b77a5c561934e08...
True v4.0.30319 C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Dynamic\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Dynamic.dll
Thanks Lance -
PowerShell: How do I get Powershell ISE to work within Service Manager Shell
I want to use PowerShell ISE from within Service Manager Shell.
When, from within the Service Manager Shell I type "ise" the PowerShell ISE launches but is not aware of the SCSM Cmdlets.
When I run:
PS C:\Program Files\Microsoft System Center 2012\Service Manager> Get-SCSMManagementPack
I get this error:
The term 'Get-SCSMManagementPack' is not recognized as the name of a cmdlet, function, scr
ipt file, or operable program. Check the spelling of the name, or if a path was included,
verify that the path is correct and try again.
At line:1 char:23
+ Get-SCSMManagementPack <<<<
+ CategoryInfo : ObjectNotFound: (Get-SCSMManagementPack:String) [], Command
NotFoundException
+ FullyQualifiedErrorId : CommandNotFoundExceptionHi,
Try this before calling any SCSM cmdlets:
CD 'C:\Program Files\Microsoft System Center 2012\Service Manager\Powershell'
Import-Module .\System.Center.Service.Manager.psd1
For R2 adjust a path.
Cheers,
Marat
Site: www.scutils.com Twitter:
LinkedIn:
Facebook: -
Hep with New-Object -ComObject InternetExplorer.Application on Powershell ISE
Hi All,
I'm trying to work on powershell ISE (windows 7) with New-Object -ComObject InternetExplorer.Application. My issue is that I can set a variable like this:
$iemessage = $ie.Document.Body.InnerText
Beacuse for some reason will be a null variable, this is the code that I'm using which do not work on ISE, but it works on the normal porwershell console
$ie = New-Object -ComObject InternetExplorer.Application
$ie.Navigate("http://www.microsoft.com/technet/scriptcenter/default.mspx")
$iemessage = $ie.Document.Body.InnerText
this is the error I get when I use $iemessage | get-member
Get-Member : No object has been specified to the get-member cmdlet.
Thanks in advance for any suggestion.Hi,
I have no explanation for why this adjustment works (I don't do much IE automation):
$ie = New-Object -ComObject InternetExplorer.Application
$ie.Navigate("http://www.microsoft.com/technet/scriptcenter/default.mspx")
Start-Sleep -Seconds 1
$iemessage = $ie.Document.Body.InnerText
The old adage of 'if you run out of options, just take a nap and see if the problem fixes itself' seems to have worked yet again.
Don't retire TechNet! -
(Don't give up yet - 13,085+ strong and growing) -
PowerShell ISE doesn't flush stdout
Hello everyone,
I'm having a little problem when running a console program in PowerShell ISE: when the program writes out a line in portions using flush, PowerShell won't show the line until the program writes a line ending. For example the program is doing something like
this (C++):
std::cout << "Doing something time-consuming..." << std::flush;
// Do something for some time
std::cout << " done in " << x << " seconds" << std::endl;
And PowerShell ISE will only show the whole line when this section of code completes. With non-ISE PowerShell this doesn't happen, the line is printed in portions as expected.
So the question is: can I somehow make PowerShell ISE disable its internal buffer and print the program's stdout directly?
Thank you.Thanks Anna but I don't think this helps in my case. I want to flush STDOUT during the execution of a program, so I can't enter any commands while PowerShell is busy executing it. Furthermore, I want it to flush automatically, when the program being executed
flushes its output. Again, PowerShell itself works the way I want, the problem is with the ISE which seems to have its own print buffer. Is it possible to change this behavior? -
How to import sharepoint modules in powershell ISE?
Hi All, could anybody tell mw how to import sharepoint modules in powershell ISE? just let the powershell ISE work as 'SharePoint 2010 Management Shell'. i don't want to download SPoshMod.
thanks, ericHi Joel ,
When I execute it I am getting the below error. Could you please share your thoughts on this.
Add-PSSnapin : The Windows PowerShell snap-in 'microsoft.sharepoint.powershell' is not installed on this machine.
At line:1 char:13
+ add-pssnapin <<<< microsoft.sharepoint.powershell
+ CategoryInfo : InvalidArgument: (microsoft.sharepoint.powershell:String) [Add-PSSnapin], PSArgumentException
+ FullyQualifiedErrorId : AddPSSnapInRead,Microsoft.PowerShell.Commands.AddPSSnapinCommand
-Vishnu -
Displaying Chinese in Powershell and Powershell ISE
I have a PS that retrieves file names and URLs from webpages, download files, display file names and download progress on screen and save files on disk.
file names are Chinese and were displayed correctly in Chinese both in Powershell console and in Powershell ISE before. But now they are displayed correctly only in Powershell ISE, not in Powershell console anymore. Any suggestion? thanks
I experienced the same with Japanese Characters.
If you are using Invoke-WebRequest,
you can try this.
$JP_MSSITE = Invoke-WebRequest www.microsoft.co.jp
if ( $JP_MSSITE.BaseResponse.ContentType.Contains("charset=") )
$TITLE = $JP_MSSITE.ParsedHtml.title
else
$METADATAS = $JP_MSSITE.ParsedHtml.getElementsByTagName("meta")
if ( $METADATAS.charset -ne $null) {
$CHARSET = $METADATAS.charset
}else{
ForEach ($METADATA in $METADATAS) {
if( $METADATA.charset -ne $null ){
$CHARSET = $METADATA.charset
break
if($METADATA.content -match 'text/html;.*charset=(.*)|charset=(.*);.*text/html')
$CHARSET = $matches[1]
break
try {
$TITLE =[System.Text.Encoding]::GetEncoding($CHARSET).GetString([System.Text.Encoding]::GetEncoding("ISO-8859-1").GetBytes($JP_MSSITE.ParsedHtml.title))
}catch{
$TITLE = "Not supported"
Write-Host $TITLE
It was asked here.
https://social.technet.microsoft.com/Forums/windowsserver/en-US/cbf40856-9157-42ae-8127-0328b4664405/cant-show-content-of-invokewebrequest-in-unicode?forum=winserverpowershell#cbf40856-9157-42ae-8127-0328b4664405 -
Reopen last used tabs in Powershell ISE
Hi Scripting Guys
I use a lot of tabs in Powershell ISE console in my work, as an Administrator, and every time I close the ISE I need to reopen every tabs that I used before. So my question is:
When I open Powershell ISE can it automatically reopen last tabs, that I used? Can Powershell ISE remember that last used tabs like IE can remember last open browser session?
Best regards,
ThorkellHi,
I do this by killing the ISE process with process explorer instead of closing the window. The next time you open the ISE it will note that it didn't shut down properly and will reopen the tabs you had open previously.
I'm not aware of a graceful way to do this though.
Don't retire TechNet! -
(Don't give up yet - 12,830+ strong and growing)
kill $PID -Force
I've done this a few times to keep my tabs when I open up ISE another time. :)
Boe Prox
Blog |
Twitter
PoshWSUS |
PoshPAIG | PoshChat |
PoshEventUI
PowerShell Deep Dives Book -
Powershell ISE v2.0 will not launch 0
In the process of consolidating and upgrading our 2003 servers to 2008, we wanted to run our current daily Powershell scripts on another server while we upgrade the server we had them running on (also a Server 2003 32-bit).
I went out and downloaded the v2.0 for server 2003 32-bit (Download the Windows Management Framework Core for Windows Server 2003 package now.) and installed it. I copied my scripts over to the same folder from the old server and when I tried to open
the Powershell ISE to do a test run on my scripts I get a pop-up that says:
"Windows PowerShell ISE has encountered a problem and needs to close. We are sorry for the inconvenience."
The only options are Debug and Close. I have tried to research this on 2003 servers and have not had any luck with a fix.
The Windows Powershell command area will open up and I can run commands but when I enter PS C:\> ISE I get the same error as trying to run it from the icon.
I have rebooted a couple times and still this persists. I was going to try and uninstall version 2.0 and install v1.0 but inthe add/remove programs it does not show any Powershell applications.
Any suggestion?
Hi,
The ISE is a .Net application, are you sure you're up to date with .Net as well?
Also, FYI if you haven't seen this -
http://support.microsoft.com/kb/2580993/en-us
Don't retire TechNet! -
(Don't give up yet - 12,950+ strong and growing) -
Executing powershell ise(x86) scripts via Task Scheduler
hi
i have powershell script that can only run with powershell ISE(X86)
and i want to add it to Task Scheduler
but my problem is when i try to test the script using "Powershell" or "run" before i add it to the Task Scheduler
using "powershell" i wrote :
C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell_ise.exe -file "c:\my path\update.ps1"
and it only open the script in powershell ISE(X86) without Executing the script
how can i Execute the script not open it ??thanks
I didnt try your solution
but i solved the problem
it was two step first instead of using Set-Culture
I use
$nc = New-Object Globalization.CultureInfo 'ar-kw'
then i add Type Font 'Courier New' to powershell font
in regedit.exe
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsNT\CurrentVersion\Console\TrueTypeFont
the character may not be readable in the console because they are from left to right and there are spaces between each character
but when i update my ADUC or send them to out-file they become readable
these are the references for solution
change the CultureInfo :
http://www.vistax64.com/powershell/16358-how-do-i-explicitly-set-currentculture.html
Add Font 'Courier New' to powershell
http://silentcrash.com/2012/05/how-to-add-hebrew-to-powershell-or-command-cmd-console/ -
Script works in PowerShell ISE but not in regular PowerShell window
Hello all!
I've got another PS conundrum to ponder. I have the following script lines:
write-host"Check
for password complexity requirements:"-foregroundcolorblack-backgroundcolorwhite
write-host""
import-moduleactivedirectory
$PasswordPolicy=Get-ADObject$RootDSE.defaultNamingContext
-PropertypwdProperties
$PasswordPolicy|Select@{n="PolicyType";e={"Password"}},`
DistinguishedName,`
@{n
="Password complexity requirements";e={Switch($_.pwdProperties)
0{"Passwords
can be simple and the administrator account cannot be locked out"}
1{"Passwords
must be complex and the administrator account cannot be locked out"}
8{"Passwords
can be simple, and the administrator account can be locked out"}
9{"Passwords
must be complex, and the administrator account can be locked out"}
Default{$_.pwdProperties}}}}
|ft*-auto
When I run this code in ISE, it works great. It returns the value for the setting "1" which is what this GPO is set to.
But, when I run this same code in elevated PowerShell prompt, I get the following error:
Any help would be greatly appreciated.Hi,
Are you creating $RootDSE before you use it?
Don't retire TechNet! -
(Don't give up yet - 13,085+ strong and growing) -
PowerShell ISE has stopped working on Win 8.1
I have Windows 8.1 with all updates.
I could launch powershell.exe but not the ISE. I could execute some of the powershell 2.0 codes but definitely not 3.0 or 4.0 codes.
Tried launching ISE with -noprofil, same error. Tried installing/uninstalling Powershell 5.0 May 2014 preview, no luck.
Faulting application name: PowerShell_ISE.exe, version: 6.3.9600.16384, time stamp: 0x5215ce45
Faulting module name: ntdll.dll, version: 6.3.9600.17031, time stamp: 0x530895af
Exception code: 0xc0000374
Fault offset: 0x00000000000f8c9c
Faulting process id: 0x15cc
Faulting application start time: 0x01cf80201ad59f4f
Faulting application path: C:\Windows\system32\WindowsPowerShell\v1.0\PowerShell_ISE.exe
Faulting module path: C:\Windows\SYSTEM32\ntdll.dll
Report Id: 595de91a-ec13-11e3-8264-1803733008d1
Faulting package full name:
Faulting package-relative application ID:Hi Katiedonut,
I’m writing to just check in to see if the suggestions were helpful. If you need further help,
please feel free to reply this post directly so we will be notified to follow it up.
If you have any feedback on our support, please click here.
Best Regards,
Anna
TechNet Community Support -
Script using Windows PowerShell ISE to move mouse and control keyboard
Hello,
I am new to PowerShell scripting, and fairly new to scripting in general.
I would like to create a script that would move the mouse to a certain location, double click, enter a number, click tab 3 three times, click spacebar, close window.
I started with: [System.Windows.Forms.Cursor]::Position = New-Object System.Drawing.Point(230,175);
But I couldn't find how to double click.
I would appreciate your help very much.##In order to move the mouse position you could use something like this:
[system.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") | out-null
[System.Windows.Forms.Cursor]::Position = New-Object System.Drawing.Point(500,500)
##In order to simulate a mouse click you could use something like this:
function Click-MouseButton
param(
[string]$Button,
[switch]$help)
$HelpInfo = @'
Function : Click-MouseButton
Purpose : Clicks the Specified Mouse Button
Usage : Click-MouseButton [-Help][-Button x]
where
-Help displays this help
-Button specify the Button You Wish to Click {left, middle, right}
if ($help -or (!$Button))
write-host $HelpInfo
return
else
$signature=@'
[DllImport("user32.dll",CharSet=CharSet.Auto, CallingConvention=CallingConvention.StdCall)]
public static extern void mouse_event(long dwFlags, long dx, long dy, long cButtons, long dwExtraInfo);
$SendMouseClick = Add-Type -memberDefinition $signature -name "Win32MouseEventNew" -namespace Win32Functions -passThru
if($Button -eq "left")
$SendMouseClick::mouse_event(0x00000002, 0, 0, 0, 0);
$SendMouseClick::mouse_event(0x00000004, 0, 0, 0, 0);
if($Button -eq "right")
$SendMouseClick::mouse_event(0x00000008, 0, 0, 0, 0);
$SendMouseClick::mouse_event(0x00000010, 0, 0, 0, 0);
if($Button -eq "middle")
$SendMouseClick::mouse_event(0x00000020, 0, 0, 0, 0);
$SendMouseClick::mouse_event(0x00000040, 0, 0, 0, 0);
##To use this function in your script, implement a command like: Click-MouseButton -Button left
##Or you could just use WASP..
Maybe you are looking for
-
Hi, I am using Oracle Business Intelligence 11.1.1.7.10. In my Dataset sql have condition as "tl_table.language = USERENV('LANG')".So it should fetch the data as per the userenv language. But it fetching only the column having the US as language i
-
How to stop the rename the cn again if it had meet the condition
How to stop to rename the CN in Active directory if running the script. This is my script: $objSearch = New-Object DirectoryServices.DirectorySearcher $dateNow = Get-Date $DomainDNS = "server2008.server1.com" #server 2008 $ADpath = [ADSI]"LDAP://$Dom
-
I'm using an iPad 2 and have upgraded to ios6. Now, when I open a web page that has embedded video, it auto-plays and then I have to search all over the page to find the video to stop it. It's extremely annoying. Is there some setting that I need to
-
How do I get footnotes to continue their numbering from previous chapters in epub?
I have INDD CS6 and have been trying to export an EPUB from a book file with about 4-5 chapters, The problem is this: I have footnotes throughout the various chapters and I want the numbering to be one single string (in other words 1-2-3-4-5-6-etc. n
-
Restrict custom metadata for DAM assets
Can we restrict custom metadata to appear only for a few DAM assets? For eg, I have assets under two folders, myProject1 and myProject2 in DAM. Suppose I want the custom metadata fields to show up only for the assets under myProject1, can that be don