Administrator Unable To Run Powershell Commands When UPD Enabled
Hi All,
We have a single Windows 2012 R2 RDS configured with UPD enabled for the defined collection. So far everything is working fine for standard users; however, the domain administrator can no longer run PowerShell commands (see attached screenshot).
I believe this is the result of the UPD "impersonating" the local c:\. How can I get around this for domain administrator accounts?
Thanks in advance.
Hi,
By UPD, you mean user profile disk, right?
In addition, all non-administrator users can run the exact same PowerShell cmdlet, right?
What about other PowerShell cmdlets, are administrators able to run them?
Best Regards,
Amy
Please remember to mark the replies as answers if they help and un-mark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact [email protected]
Similar Messages
-
Run powershell command in app part on submitting item in O365 Sharepoint list.
I need to fire an powershell command through app part as soon as i have submitted details or form on the list.
As powershell command requires inputs, i have created list and a form into it, i mapped the column with the powershell input, but the commands is not running or firing, please help.
Regards
Mohit JainHi,
According to your description, my understanding is that you want to run a Powershell command when submitting a form on the list to create mailbox for user.
As your environment is Office 365, I suggest you can create a web service to call the PowerShell Command using C#. Then in the office 365 list, you can create a remote event receiver to trigger the web service to
achieve it.
Here are some detailed articles for your reference:
http://msdn.microsoft.com/en-us/library/ms464040%28v=office.12%29.aspx
http://www.codeproject.com/Articles/18229/How-to-run-PowerShell-scripts-from-C
http://msdn.microsoft.com/en-us/library/office/jj220043(v=office.15).aspx
Best Regards
Forum Support
Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
[email protected]
Zhengyu Guo
TechNet Community Support -
Using C# to run PowerShell command to create VirtualDirectory fails
I can run these commands with no problem directly in PowerShell. But trying to get C# to run them, I receive errors.
md d:\ftproot\vdir\test20140317A;
New-WebVirtualDirectory -Site "[site]/[a virt directory]" -Name test20140317A -physicalPath d:\ftproot\vdir\test20140317A;
When running in c# through two different means, I receive these errors
Exception:Caught: "A parameter cannot be found that matches parameter name 'physicalPath'." (System.Management.Automation.CmdletInvocationException)
A System.Management.Automation.CmdletInvocationException was caught: "A parameter cannot be found that matches parameter name 'physicalPath'."
Though in Visual Studio , there's something called InteliTrace and it's showing a whole slew of exceptions starting with
Exception:Thrown: "Unable to load DLL 'wldp.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)" (System.DllNotFoundException)
A System.DllNotFoundException was thrown: "Unable to load DLL 'wldp.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)"
Exception:Thrown: "Requested registry access is not allowed." (System.Security.SecurityException)
A System.Security.SecurityException was thrown: "Requested registry access is not allowed."
Exception:Thrown: "Cannot find path 'C:\Users\jpacella\Documents\WindowsPowerShell\Modules' because it does not exist." (System.Management.Automation.ItemNotFoundException)
A System.Management.Automation.ItemNotFoundException was thrown: "Cannot find path 'C:\Users\jpacella\Documents\WindowsPowerShell\Modules' because it does not exist."
Exception:Thrown: "Could not load file or assembly 'Microsoft.IIS.PowerShell.Framework' or one of its dependencies. The system cannot find the file specified." (System.IO.FileNotFoundException)
A System.IO.FileNotFoundException was thrown: "Could not load file or assembly 'Microsoft.IIS.PowerShell.Framework' or one of its dependencies. The system cannot find the file specified."
Exception:Thrown: "Cannot find path 'C:\Users\jpacella\Documents\WindowsPowerShell\Modules' because it does not exist." (System.Management.Automation.ItemNotFoundException)
A System.Management.Automation.ItemNotFoundException was thrown: "Cannot find path 'C:\Users\jpacella\Documents\WindowsPowerShell\Modules' because it does not exist."
Exception:Thrown: "Process should have elevated status to access IIS configuration data." (System.InvalidOperationException)
A System.InvalidOperationException was thrown: "Process should have elevated status to access IIS configuration data."
Exception:Thrown: "Object reference not set to an instance of an object." (System.NullReferenceException)
A System.NullReferenceException was thrown: "Object reference not set to an instance of an object."
Exception:Thrown: "Cannot find drive. A drive with the name 'IIS' does not exist." (System.Management.Automation.DriveNotFoundException)
A System.Management.Automation.DriveNotFoundException was thrown: "Cannot find drive. A drive with the name 'IIS' does not exist."
Exception:Thrown: "" (System.Management.Automation.ParameterBindingException)
A System.Management.Automation.ParameterBindingException was thrown: ""
Exception:Thrown: "The pipeline has been stopped." (System.Management.Automation.PipelineStoppedException)
A System.Management.Automation.PipelineStoppedException was thrown: "The pipeline has been stopped."
Exception:Thrown: "A parameter cannot be found that matches parameter name 'physicalPath'." (System.Management.Automation.CmdletInvocationException)
A System.Management.Automation.CmdletInvocationException was thrown: "A parameter cannot be found that matches parameter name 'physicalPath'."
These are the two different ways I invoked the script
PowerShell ps = PowerShell.Create();
ps.AddCommand("New-Item")
.AddParameter("Path", newPathName)
.AddParameter("ItemType", "directory");
ps.AddStatement().AddCommand("New-WebVirtualDirectory")
.AddParameter("Site", Properties.Settings.Default.VirtualDirectoryPath)
.AddParameter("Name", userName)
.AddParameter("physicalPath", newPathName);
ps.Invoke();
and (scriptContents is a string holding the
Runspace runspace = RunspaceFactory.CreateRunspace();
runspace.Open();
Pipeline pipeline = runspace.CreatePipeline();
pipeline.Commands.AddScript(scriptContents);
pipeline.Commands.Add("Out-String");
Collection<PSObject> results = pipeline.Invoke();
runspace.Close();I tried yet another way to make a Virtual Directory:
public void CreateVirtualDirectory2(string userName, string password)
string newPhysicalPathName = Path.Combine(Properties.Settings.Default.PhysicalPathForVirtualDirectory, userName);
StringBuilder sb = new StringBuilder();
if (Directory.Exists(newPhysicalPathName) == false)
sb.AppendLine(@"md " + newPhysicalPathName);
sb.AppendLine("cd iis:");
sb.AppendLine("cd Sites");
sb.AppendLine("cd ftp");
sb.AppendLine(@"New-Item 'IIS:\Sites\ftp\bridgenet\" + userName + @"' -Type VirtualDirectory -physicalPath " + newPhysicalPathName);
string script = VirtualDirectoryScript(sb.ToString());
RunspaceInvoke invoker = new RunspaceInvoke();
try
invoker.Invoke(script);
catch (Exception e)
Console.ForegroundColor= ConsoleColor.Black;
Console.BackgroundColor = ConsoleColor.Red;
Console.WriteLine("ERROR: " + e.Message);
Console.ResetColor();
And the same exception occurs
"A parameter cannot be found that matches parameter name 'physicalPath'."
When I run the script outside of C#, there's no error.
So no one's responded yet , which is pretty disappointing. -
Using the "Run Powershell command" in Task Sequence
Hi,
We are having problems executing PowerShell Scripts from within a TaskSequence. We use this to perform different actions on our servers.
* We have a GPO for Windows PowerShell that is set to "allow all scripts"
* In Sccm, the computer agent setting is set to "bypass"
*In the deployement we specify that we want to run the content from the DP
When we run the TaskSequence, powershell is started but the script is not executed. The TS is stuck at this time and is just waiting for the script to execute... After killing the powershell process, the TS failes (of course).
How can we get this working:
-by disabling the GPO -> indeed then it works
-by downloading the content locally (we don't want that either)
Is there any other solution to this?
I've also tried this but no go:
Quote:
Please note, that this policy will only work for scripts which are executed locally. If you want to execute ps1 scripts from a network drive it might be neccessary to add the dp server name into the trusted sites of the IE!
Source:http://social.technet.microsoft.com/Forums/en-US/a2d44774-a352-40f6-93be-037ccf0bc98b/not-able-to-execute-powershell-scripts-when-running-a-task-sequence-or-running-from-packageprogram?forum=configmanagersdk
I also tried to run it via the command line option and call powershell.exe, same problem. Executing a scriptblock on the other hand does work. (In the scriptblock, it put get-executionpolicy and it is returning unrestricted)
Thanks,
WiM
IC3CUB3Add below to .ps1 file
$session = New-pssession
Import-PSSession $session
New-ItemProperty 'HKLM:\Software\Microsoft\Windows\CurrentVersion\AutoRotation' -Name Enable -Value 0 -PropertyType Dword"
Schedule task
================
Program to choose
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
add argument section
powershell.exe -noprofile -executionpolicy bypass -file \\server\file.ps1 -
Running Powershell command from PHP returns blank page
Hi. :-)
I have this script :
<?php
$q = shell_exec('powershell Get-Help');
echo $q;
?>
This works well and gives me output.
But... When I change Get-Help with Get-VM it gives me blank page as ouput. I have simillar problems with other Hyper-V cmdlets.
This is code 1:
<?php
$q = shell_exec('powershell Get-VM');
echo $q;
?>
This code gives me blank page.
Code 2:
<?php
$q = shell_exec('powershell Start-VM 'Vm1'');
echo $q;
?>
This code gives me that it cannot find VM with that name.
What's the problem, what to change in script or system settings.
Note: All this commands WORK and gives me output when I run it from cmd
Things that I did:
1. Changed execution policy to Unrestricted
2. Added 2<&1 at the end of shell_exec.
Thanks in advance.Hi,
I think we should run powershell as adminitrator to get VMs.
Start-Process "$psHome\powershell.exe" -Verb Runas -ArgumentList '-command "Get-VM"'
Regards,
Yan Li
Regards, Yan Li -
Run powershell commands on a bat file
Hello,
I can call powershell on command line as below:
C:\>echo I am in Command Shell
I am in Command Shell
C:\>powershell
Windows PowerShell
Copyright (C) 2009 Microsoft Corporation. All rights reserved.
PS C:\> Write-Host I am in Powershell
I am in Powershell
PS C:\> exit
C:\>echo I returned to Command Shell
I returned to Command Shell
But I want to create a bat file and run these commands in bat file. To do this, I copied and pasted same codes to Test.bat file:
echo I am in Command Shell
powershell
Write-Host I am in Powershell
exit
echo I returned to Command Shell
But after "powershell" command nothing worked as below:
C:\>.\Test.bat
C:\>echo I am in Command Shell
I am in Command Shell
C:\>powershell
Windows PowerShell
Copyright (C) 2009 Microsoft Corporation. All rights reserved.
PS C:\>
I want this output:
I am in Command Shell
I am in Powershell
I returned to Command Shell
How can I handle this problem.
PS: I don't want to use powershell file (*.ps1).
ThanksIn my Test.bat file there are some commands. My Test.bat file is sth like this:
@echo off
echo I am in Command Shell
powershell.exe
Write-Host I am in Powershell
$Var = "Some words"
Write-Host My ID: $Id, String: $Var
exit
echo I returned to Command Shell
There are other different commands, such as importing modules or setting variables or configuring computer settings,.... So, I think "powershell -command" is not applicable.
In brief;
Above codes work in command line.
But when I use same codes in a batch file, nothing works in powershell. Result is sth line this:
C:\>Test.bat
I am in Command Shell
Windows PowerShell
Copyright (C) 2009 Microsoft Corporation. All rights reserved.
PS C:\> -
Unable to run powershell comamnd (stsadm -o preupgradecheck) on sharepoint 2010
when i m running this command ....powershell message is saying
"Missing operation name or the operation name is invalid"
stsadm -o preupgradecheck
we are having sharpeoint 2010.Can you type
stsadm -o preupgradecheck
What version of sharepoint is installed on computer. and what is the current update level
Do you see stsadm.exe file in C:\Program
files\Common
Files\Microsoft Shared\Web Server Extensions\14\bin -
Unable to run export command invalid username and password
i am trying to run export command to export the complete database but i am getting error of invalid user name and password
command
from root i am switching to
su- oracle
exp oracle/12345 file=03-2-2013BackupDB.dmp log=backuplog.log
ORA-01017: invalid username/password; logon denied
but when i use to login through putty it gives no error
oracle
12345
maybe i am doing something wrong sorry as i am newbie in oracle world
oracle 11gR2
Suselinux
Please help..................to make your database in archive log mode you need to give a downtime of your database for this you can do following steps.
if you are using spfile
1. shutdown the database.
2. startup in mount mode
3. use command 'alter database archivelog';
4. specify the archive log location using command
' alter system set log_archive_dest_1='LOCATION=location_path';'
5. specify archive log format as
'alter system set archive_log_format=your choice;'
6. enable the archive log dest using ' alter system set log_archive_dest_state_1=enable;' -
Is it possible to run a command when a monitor goes to a healthy state?
Hi, I'm using SCOM 2007R2
Is it possible to run a command/script when a web application Monitor changes to a healthy state?
I have a web application monitor that checks four different websites from our proxy servers. on the aggregate rollup of all four sites I have a health rollup policy of 'Best state' meaning
that the monitor will only go critical if all four sites are unreachable. If that happens I have a Diagnostic task that runs to Stop the w3svc service.
This stops the proxy server serving ‘Page cannot be displayed’ content to the users within the company.
What I would like to do is start IIS automatically when the web application monitor goes to a healthy state.
I’m guessing I’m going to need a script that perhaps pings the sites every few minutes then starts the w3svc service if it gets a result.Hi,
I recommend you touch the Orchestrator, Orchestrator can integrate
SCOM.
Use Orchestrator to design a Runbook for your task. When the state of a web application Monitor changes to healthy, then run a command/script.
System Center 2012 Orchestrator.
Orchestrator is a workflow management solution for the data center. Orchestrator lets you automate the creation, monitoring, and deployment of resources in your environment.
For more information, please review the link below:
System Center Integration Pack for System Center Operations Manager 2007 R2
http://technet.microsoft.com/en-us/library/hh531770.aspx
We
are trying to better understand customer views on social support experience, so your participation in this
interview project would be greatly appreciated if you have time.
Thanks for helping make community forums a great place. -
Unable to run Java Command (on UNIX)
Hi,
When I try to run Java command:
java ChatServer 9830
I get the following error:
/usr/bin/java: line 67: /tmp/javaJb9694: Permission denied
/usr/bin/java: line 67: /tmp/javaJb9694: Success
Could any one suggest what could be the reason and solution.
The site is hosted on a UNIX palatform and we are using Tomcat.
Thanks & Regards,
Joy.lol
How would we know? We don't know your setup, we don't know your software, we don't know what happens...
It doesn't even look like a standard Java message to me. -
Terminal runs a command when opened
Whenever I open the terminal, it runs some command I ran ages ago, for no appearant reason (in this case, CDs to some random library folder). It's getting quite annoying really, any idea what's causing this? If I knew what was causing it, I could set it to good use because there is a certain folder I DO need to cd into every time I launch the terminal...
And the last command there is checked, but unchecking it didn't fix it either,Well, since there was no file (saved .term) specified it shouldn't make a difference.
The simplest thing to do is to clear Terminal's preferences, by dragging ~/Library/Preferences/com.apple.Terminal.plist to your Desktop (with Terminal not running) and try again. If that clears it you can Trash the .plist from your Desktop. -
Unable to run BeginDDL on a version enabled table on OWM 9.2.0.8
Hello,
We running Oracle 9i with OWM 9.2.0.8
We are trying to run BeginDDL on a version enabled table with approx 2.8 million records
in it. And when we try running the statment:
BEGIN
DBMS_WM.BeginDDL('PFS_SPOT_SHOTS');
END;
We get the following error:
ORA-20203: enable/disable versioning or begin/commitDDL is being executed on PFSDB.PFS_SPOT_SHOTS
ORA-06512: at "WMSYS.OWM_DDL_PKG" line 3378
ORA-06512: at "WMSYS.LT", line 11827
ORA-06512: at line 2
We also try running BeginDDL on another version enabled table with no data in it
BEGIN
DBMS_WM.BeginDDL('PFS_DUMMY_POINT');
END;
then we are getting the following error:
ORA-25150: ALTERING of extent parameters not permitted
ORA-06512: at "WMSYS.OWM_DDL_PKG", line 3378
ORA-06512: at "WMSYS.LT", line 11827
ORA-06512: at line 2
Any suggestions in regards to this problem?
Thanks
Gary1) For the first table PFS_SPOT_SHOTS that we are having trouble with, the query return the following:
select * from wmsys.all_wm_versioned_tables t
where table_name = 'PFS_SPOT_SHOTS';
TABLE_NAME OWNER STATE HISTORY NOTIFICATION NOTIFYWORKSPACES CONFLICT DIFF VALIDTIME
PFS_SPOT_SHOTS PFSDB RB_IND VIEW_WO_OVERWRITE NO NO NO YES
2) For the second table PFS_DUMMY_POINT table, the query return the following:
select * from wmsys.all_wm_versioned_tables t
where table_name = 'PFS_DUMMY_POINT';
TABLE_NAME OWNER STATE HISTORY NOTIFICATION NOTIFYWORKSPACES CONFLICT DIFF VALIDTIME
PFS_DUMMY_POINT PFSDB VERSIONED VIEW_WO_OVERWRITE NO NO NO YES
Other than the PFS_DUMMY_POINT table, the query for other version enabled table also return STATE:VERSIONED except the PFS_SPOT_SHOTS table
We have filed a SR, and the number is : 7599412994
Thank you for your response. -
Unable to run ejbc command!!!
I am compiling my ejbs and after jarring the classes and META-INF when i run the ejbc <jarfilename> <outjarname> thit says
'ejbc' is not recognized as an internal or external command,
operable program or batch file.
how do i set the classpath and path to run the ejbc command......am using weblogic 8.1 version and jdk1.3Add the weblogic server's bin directory to your PATH. You will need to a couple of WLS jars to the CLASSPATH. There might be something in the installation/setup documentation that tells you all this. I have only used WLS 5.1 and 7.0.
-
Unable to run JAVAC command at DOS prompt
I installed JDK1.3.1 I gave the pathas
C:\JDK1.3.1 and changed the Autoexec.bat file to have
Set Path=C:\JDK1.3.1\Bin;
When I am trying to run command javac it gives me this message
This program cannot be run in DOS mode
I cant start, Please help
Thanks
EhsanDid you reboot the system after the install -- what you put in the autoexec.bat doesn't become effective until the system has been rebooted.
If you don't want to reboot, you can try this:
C:\JDK1.3.1\Bin\javac -classpath C:\JDK1.3.1 HelloWorld.java
V.V. -
Unable to run curl command from process c#
Below is the curl command i am trying to run from c# script and i failed to execute please help
curl -K config.cfg
http://10.10.10.10:8080/MyApp/task
string curlDirectory = "E:\\application";
string curlArg1 = " -K ";
string curlArg2 = "config.cfg";
string curlArg3 = " http://10.10.10.10:8080/MyApp/task";
Process process = new Process();
process.StartInfo.FileName = "cmd.exe";
process.StartInfo.UseShellExecute = false;
process.StartInfo.CreateNoWindow = true;
process.StartInfo.RedirectStandardInput = true;
process.StartInfo.RedirectStandardError = true;
process.Start();
StreamWriter sw = process.StandardInput;
sw.WriteLine("cd " + curlDirectory);
sw.WriteLine("curl " + curlArg1 + curlArg2 + curlArg3);
sw.WriteLine("exit");
sw.Close();
C:>cd E:\application\
E:\application>curl -K config.cfg
http://10.10.10.10:8080/MyApp/task
E:\application>exitDid you get any error? can you remove the below line and try:
process.StartInfo.CreateNoWindow = true;
Fouad Roumieh
Maybe you are looking for
-
"Open document with" has started to appear
GroupWise 7 client and server - we do not integrate our documents with the appropriate applications when installing GroupWise clients. Until recently when double clicking on a document in the library - either by browsing the library directly or using
-
Dear All, There are three radio buttons displayed while editing the Addresses in ESS. The valid from option always defaults the date to current system date. Can the date on this option be set to blank and not as a default system date. I have tried us
-
It seems that I'm getting errors with the two repositories listed in the stickied thread at the top of this subforum, as well as Twilight Lair. Anyone know what's going on with these servers? # clyde -Syy :: Synchronizing package databases... core 36
-
Why does Select get BBC America but the more expensive Preferred doesn't? I switched from Select to Preferred thinking I would get better value, but I lost one of three channels that I actually watch. In fact, EVERY plan has BBC except for the Prefe
-
Subtitles not appearing when play all selected.... please help
Hello All, The deal goes like this... I am making a DVD for a national park and I have 4 videos 3 of which have subtitles. The subtitles are on a separate menu and you don't have to select to show subs, they are automatically selected when the viewer