Why task scheduler is not running powershell script in clearcase dynamic view [network share ]when the machine is locked? - powershell

I am using windows 2008 R2 64 bit Operating system. I have clearcase dynamic view. [You can think of it as a network mapped drive]
When scheduling basic task with the option "Run whether the user is logged on or not" , my powershell script is not executing.
It says operation executed successfully but nothing has been done. Our build will send mail at the end I did not receive any mail.

You can think of it as a network mapped drive
Not exactly: this is a MVFS mounting point.
Make sure you are:
using the full and complete path of a dynamic view: M:\myView\myVob\...
executing your script in a vob (M:\myView\myVob or below) and not in the view (M:\myView)

Related

PowerShell - Transfer Files Using BITS protocol as a scheduled task - not working when logged off

I have written a PowerShell script which uses the BITS transfer protocol in order to transfer large files from Source machine to destination machine. When I run the PowerShell script manually logging into my destination remote machine (where the files need to be copied) then the files are getting copied without any issues.
But When I have created a scheduled task that runs the PowerShell script daily at a particular time. It is throwing the following error
The operation being requested was not performed because the user has not logged on to the network. The specified service does not exist. (Exception from HRESULT: 0x800704DD)
The script is getting worked only when I log-in to my destination machine where the file is being copied. If at all I log off from that machine at that scheduled task time then I am getting the error. Please suggest what needs to be done in order to make the scheduled task run even if I log off from that machine.
According to the documentation about BITS found on https://msdn.microsoft.com/en-us/library/windows/desktop/aa362708(v=vs.85).aspx (and the specific Powershell documentation found on https://msdn.microsoft.com/en-us/library/windows/desktop/ee663885(v=vs.85).aspx) the user that created the jobs has to be logged on.
Powershell Doc :
Important  
When you use *-BitsTransfer cmdlets from within a process that runs in a noninteractive context, such as a Windows service, you may not be able to add files to BITS jobs, which can result in a suspended state. For the job to proceed, the identity that was used to create a transfer job must be logged on. For example, when creating a BITS job in a PowerShell script that was executed as a Task Scheduler job, the BITS transfer will never complete unless the Task Scheduler's task setting "Run only when user is logged on" is enabled
Generic documentation :
BITS continues to transfer files after an application exits if the user who initiated the transfer remains logged on and a network connection is maintained. BITS will not force a connection.
BITS suspends the transfer if a connection is lost or if the user logs off. BITS persists transfer information while the user is logged off, across network disconnects, and during computer restarts.
In short : what you want is not possible.
(this is one of the reasons why you should always read the documentation when encountering problems like these)

Is it possibile to remotely process an SSAS cube throgh script?

I have an SQL Server Analysis Service (SSAS) cube (developed with BIDS 2012) and I would like to give the opportunity to the users (that use cube through PowerPivot) to process the cube in their local machines.
I found some material on how to make a scheduled job on the server through Powershell or SQL Agent or SSIS but no material on remotely process the cube. Any advice?
There are several possibilities to trigger a cube processing. The low level method is issuing an XMLA statement to the database containing the cube. To see how this looks like, open SQL Server Management Studio, connect to the AS instance, right-click on an AS database, and select "Process". Configure the processing settings, but instead of hitting OK, select "Script from the top toolbar to have the XMLA process command be generated for you. Leave the dialog with Cancel.
All methods that process a cube end in some way or the other in sending a command like this to the AS database.
There are several options to trigger a cube processing:
In Management Studio, by clicking OK in the above mentioned dialog.
In PowerShell (see http://technet.microsoft.com/en-us/library/hh510171.aspx).
In Integration Services, there is an Analysis Services processing task (http://msdn.microsoft.com/en-us/library/ms141779.aspx).
You can set up a SQL Server Agent job, job steps could either be a direct XMLA step, or an Integration Services step containing the process task (among possibly other tasks).
The question, however, is how the setups described above can be accessed by end users. An important issue here is of course that the user executing the process task needs to have the permission to process the cube. As you might not want to give this permission directly, it might make sense to use some impersonation on the way of calling it. With Management Studio - and as far as I am aware with PowerShell - this cannot easily be achieved.
Integration services and Agent jobs offer the possibility of impersonations. Integration services packages are executed by the dtexec command line tool (part of the SQL Server client tools), there is also a tool called dtexecui (available as "Execute Package Utility" in a standard SQL Server client tool installation), which lets you use a dialog to configure all settings, and then execute a package, but it also can display the command line for dtexec, according to your settings.
And to call a SQL Server Agent job, an easy interface are the stored procedures (http://msdn.microsoft.com/en-us/library/ms187763.aspx), especially sp_start_job (Note this is asynchronous, you call it, it starts the job and returns. It does not wait for the job to complete before returning.) and sp_help_jobactivity to ask for job status as well as sp_help_jobhistory for details of jobs that were running.
All in all I think there is no final solution available, but I mentioned some building blocks that you could use to code your own solution, depending on the preferences in your environment.

Test Automation tool not running via Windows Task Scheduler

Here is a general description of the issue which I cannot solve:
We have a WindowsServer 2008 R2 system that is used to running the install of our product(using powershell script), and then the Powershell script calls the .exe of our UI test automation tool (Ranorex).
The install of the product works fine, but the UI automation portion only runs if some is physically logged in via remote desktop.
If the remote desktop session is closed (but the programs continue to run..so user is technically logged in), the UI automation portion will NOT run.
The options I selected on the General tab of the job are:
-Run only when the user is logged in;
-Run with highest privileges;
Any ideas on from anyone who has had this issue and got it to work would be extremly helpful.
Thanks,
Eric
UI operations are usually in suspended state when a user is disconnected from an RDP session. Use a tool like VNC or equivalent where you have access to the main console for these UI operations to remain active.

Running a cgi perl script as an Administrator

I'm writing a perl script for a website, and I need to be able to control VirtualBox via the website. I'm not sure where to start, or if I'm even trying to debug in the right area, but here goes.
My server is running IIS7 on Windows Server 2008 R2. I'm also running 2 virtual machines through the vboxmanage command line interface. These VMs are running under SERVER\administrator.
When I open my website, it requests a login. I login to the website as SERVER\administrator and click a link that calls my script using an xmlhttprequest. Now, normally, it doesn't matter what user I run these as, but with vboxmanage, if I run the command as a different user, the list of VMs is different. I tried whoami, which returned SERVER\administrator, but %DOMAINNAME%\%USERNAME% returns the domain that the server is connected to as dommainname and SERVER$ as the username. The vboxmanage command then fails.
On the website, impersonation is turned on. When I turn impersonation off, the whoami request changes to be iis apppool\website. Any ideas on how to get around this?
As a final note, I've thought about using runas, but since it prompts for a password, there's no way to call it through scripting (and that would be a poor security decision, I'd imagine).
This is an oft recurring, well-known and well-solved problem. Instead of having one big program dealing with requests from the Web and managing the VM (strong coupling), separate the concern and write two programs, each doing exactly one task.
The user facing program running in the Web server context can continue with limited privileges. The VM manager is a stand-alone program running with the necessary admin privileges, either repeatedly from the scheduler or as daemon/service.
Have the first communicate with the second over a message-queue.

Scheduled execution of Testcomplete fails

With TestComplete 8 we have a script that is scheduled to start 06:00 every morning by this line:
"C:\Program Files\Automated QA\TestComplete 8\Bin\TestComplete.exe" "C:\Attracs\TestComplete\Attracs\AttracsTEST\AttracsTESTProject.mds" /r /e /SilentMode
The problem is that this often fails. The log remark says:
An error occurred while calling the "Keys" method or property of the "TcxCustomInnerTextEdit" object.
The object or one of its parent objects does not exist.
If I connect to the computer with Remote Desktop and manually run the script it works fine.
There is no screensaver active and the power scheme is set to never sleep.
I have noticed that Testcomplete needs a handle to GUI (the screen is visible) or the script got this kind of errors. Could it be that when it starts it have no handle to the GUI components because they aren't visible ?
From the helps Running Tests via Remote desktop:
However, if you minimize the Remote Desktop window (the window that display the remote computer’s desktop), the operating system switches the remote session to the GUI-less mode and does not display windows and controls. As a result, TestComplete (or TestExecute) is unable to interact with the tested application’s GUI, as the GUI does not actually exist in this case and your automated GUI test fails.
To avoid this issue, you can keep the Remote Desktop window visible during the test run, but this may be inconvenient as it occupies some part or even your entire screen and leaves less space for you to run your local applications.
Any solution for this?
There is a way to enable the console connection in Windows to be active at all times, which allows TestComplete to work without actually connecting with RDP.
From: Running Tests in Minimized Remote Desktop Windows
Log in to the computer from which you
connect to remote computers.
Close all open Remote Desktop
sessions.
Launch the Registry editor
(Regedit.exe).
If you have a 32-bit operating system:
Locate the
HKEY_CURRENT_USER\Software\Microsoft\Terminal
Server Client\ Registry key if you
want to change the connection settings
for the current user only.
-- or --
Locate the
HKEY_LOCAL_MACHINE\Software\Microsoft\Terminal
Server Client\ Registry key if you
want to change the connection settings
for all the users.
Create a new DWORD value in this key
and name it
RemoteDesktop_SuppressWhenMinimized.
Specify 2 as the value data.
If you have a 64-bit operating system:
Locate the
HKEY_CURRENT_USER\Software\Wow6432Node\Microsoft\Terminal
Server Client\ Registry key if you
want to change the connection settings
for the current user only.
-- or --
Locate the
HKEY_LOCAL_MACHINE\Software\Wow6432Node\Microsoft\Terminal
Server Client\ Registry key if you
want to change the connection settings
for all the users.
Add the
RemoteDesktop_SuppressWhenMinimized
value to the key.
I found this page
http://www.automatedqa.com/support/viewarticle/12567/viewarticle.aspx?aid=12567
It seems that a solution could be that running TestComplete in a Virtual machine.
/Roland
To run any UI test, the UI needs to be available. Hence, the machine should be unlocked so that TestComplete can perform user actions like mouse click, keys, etc to work.
However, if you have non UI test like running Web Services then it will work.