Multi-Select Script Runs in ISE, not on remote Hyper-V Server
Hello All!
I've created a powershell script to allow a user to launch one of several management tools on a Hyper-V server. The script runs fine in Powershell ISE on my system (none of the tools work, obviously) but when I run it on the remote server, these errors
come up:
At C:\Mgmt\MgmtSel.ps1:70 char:1
+ }
+ ~
Unexpected token '}' in expression or statement.
At C:\Mgmt\MgmtSel.ps1:72 char:1
+ }
+ ~
Unexpected token '}' in expression or statement.
At C:\Mgmt\MgmtSel.ps1:73 char:1
+ }
+ ~
Unexpected token '}' in expression or statement.
+ CategoryInfo : ParserError: (:) [], ParseException
+ FullyQualifiedErrorId : UnexpectedToken
When I paste it directly into the Powershell window, it runs fine. So strange! I know my brackets are correct, or it wouldn't run when pasted into the shell or in ISE. Anyway, any help you could provide would be appreciated. Thank you all for your time!
Here's the script:
<######################################################################
Present user with options to launch one of several management programs
Save as MgmtSel.ps1 in c:\Mgmt
v 0.1 Basic Menu Presentation for different management tools
Written By Ricky Carleton
Based on code by Paul Westlake
######################################################################>
$xAppName = ‘MgmtSel’
[BOOLEAN]$global:xExitSession=$false
function LoadMenuSystem(){
[INT]$xMenu1=0
[INT]$xMenu2=0
[BOOLEAN]$xValidSelection=$false
while ( $xMenu1 -lt 1 -or $xMenu1 -gt 4 ){
CLS
#… Present the Menu Options
Write-Host “`n`tLogin Management Tools Selection – Version 0.1`n” -ForegroundColor Magenta
Write-Host “`t`tPlease select the admin area you require`n” -Fore Cyan
Write-Host “`t`t`t1. sconfig console” -Fore Cyan
Write-Host “`t`t`t2. Corefig” -Fore Cyan
Write-Host “`t`t`t3. Hyper-V Mgmt” -Fore Cyan
Write-Host “`t`t`t4. Quit and exit`n” -Fore Cyan
#… Retrieve the response from the user
[int]$xMenu1 = Read-Host “`t`tEnter Menu Option Number”
if( $xMenu1 -lt 1 -or $xMenu1 -gt 4 ){
Write-Host “`tPlease select one of the options available.`n” -Fore Red;start-Sleep -Seconds 1
Switch ($xMenu1){ #… User has selected a valid entry.. load next menu
1 {
CLS
Write-Host “`t`tStarting sconfig`n” -Fore Cyan
start c:\Windows\System32\sconfig.cmd
2 {
CLS
Write-Host “`t`tStarting Corefig`n” -Fore Cyan
C:\Corefig\COREFIG.PS1
3 {
while ( $xMenu2 -lt 1 -or $xMenu2 -gt 3 ){
CLS
# Present the Menu Options
Write-Host “`n`tSelect the Hyper-V Mgmt Tool you would like to use`n” -Fore Cyan
Write-Host “`t`t`t1. PSHVM30” -Fore Green
Write-Host “`t`t`t2. ProHVM (not working yet)” -Fore Green
Write-Host “`t`t`t3. Go to Main Menu`n” -Fore Green
[int]$xMenu2 = Read-Host “`t`tEnter Menu Option Number”
if( $xMenu1 -lt 1 -or $xMenu1 -gt 3 ){
Write-Host “`tPlease select one of the options available.`n” -Fore Red;start-Sleep -Seconds 1
Switch ($xMenu2){
1 {
CLS
Write-Host “`t`tStarting PSHVM`n” -Fore Cyan
call powershell -WindowStyle Hidden C:\PSHVM30\hyperv.ps1
2 {
CLS
Write-Host “`t`tStarting Corefig (For now, later, ProHVM)`n” -Fore Cyan
start C:\Corefig\COREFIG.PS1
default { Write-Host “`n`tYou Selected Option 3 – Go to Main Menu`n” -Fore Yellow; break}
default { $global:xExitSession=$true;break }
LoadMenuSystem
If ($xExitSession){
Exit-PSSession #… User quit & Exit
} Else {
C:\Mgmt\MgmtSel.ps1 #… Loop the function
How are you running the script on the server? Pasting into the ISE on the server, saving as a script and running it from the command line on the server? Or something else?
When you say you paste it into the PowerShell window and it runs fine, is this PowerShell window on your machine or the server? How are you pasting it (RDP? Teamviewer? VNC?).
It appears that some of the characters are not being saved/pasted correctly. You could try paste into notepad first and make sure all the characters are correct there, then select all and paste into the window on the server, or use noteapad to save the document
as a regular text file before copying to the server.
Similar Messages
-
I created a script to add logos to photos at a club and now when I run the script, the script runs but does not actually place anything on the photo itself. What's going on?
He meant post it here, of course, Louie! How on Earth would you post it "on Photoshop" ?
Thank you for the belly laugh. -
Multi-Select (drop down list) data not saving upon save/email
I have created a drop down list and modified it to allow multiple selection, i.e.
form1.BusinessAreaTable[1].Row1[4].ERP::ready:form - (JavaScript, client)
this.ui.choiceList.open= "multiSelect"; this.rawValue
= "-1"
However, when I go to save the form and/or email the list fields erase and the data / items I selected are gone.
Please help, thanks.Okay, I have the form now.
You are using script in the form Ready event to make a dropdown list mimic a listbox. This is totally unnecessary. I have changed the ERP to a multi-select listbox in the Object > Field palette and commented out the script.
Here is the form: https://acrobat.com/#d=K*P4xKIA4kkqEHGTpgyvvw
The form has not been Reader Enabled, so user with Reader will not be able to save the data inputted or submit by email in PDF format:
Summary here:
http://assurehsc.ie/blog/index.php/2010/05/using-livecycle-forms-in-acrobat-and-reader/
Niall -
We setup a server core single node cluster (W2012 R2). The MS DTC is running, and the Distributed Transaction Coordinator firewall rules are enabled. I can connect to the firewall rules and compmgmt.msc remotely for this server. When
I attempt to connect to the Component Services Management console with this server, the MS DTC object is not displayed. Only the COM+ applications are displayed. We've setup other server core instances with out clustering and DTC is displayed.Hi Steve,
We just finished the local test and found this behavior is by design. It’s expected that we can’t see the DTC remotely from component services for a cluster node.
In my lab, 2012R2 node3 is a single node cluster and has DTC role. -
Powershell script run with TaskScheduler not stopping VM's
I have a script that stops and starts the VM's, and copies files and it works ok when I run it with powershell, but when I run it with TaskScheduler, it's not stopping/starting the VM's (but does copy files). We have server 2008 R2. I updated
powershell to version 3 and downloaded and installed the Hypver-V powershell module from Microsoft.
Also, when I run the script through powershell, I needed to run as administrator. When I run it with the powershell prompt this is what it looks like:
C:\windows\system32> powershell -NoProfile -noninteractive -ExecutionPolicy bypass -Command "& c:\Scripts\BackupVhdShell_2_param.ps1 -single_backup_file_to_loc 'E:\' -single_backup_file_from_loc 'S:\SQL-bak.vhd'"
So that works from powreshell to start/stop vm's and copy files.
In Task Scheduler, this is how I have it set up:
Run with highest priviledges is checked. I have my login credentials saved so it can wake up the server when I'm not here or if it's not up.
In The Program/script field: %SystemRoot%\SysWow64\WindowsPowerShell\v1.0\powershell.exe
In the Add Arguments field: -NoProfile -noninteractive -ExecutionPolicy bypass -Command "& c:\Scripts\BackupVhdShell_2_param.ps1 -single_backup_file_to_loc 'E:\' -single_backup_file_from_loc 'S:\SQL-bak.vhd'"
Any thoughts? I'm not sure if TaskManager isn't finding HyperV module?
This is what the majority of the script looks like:
param($single_backup_file_to_loc, $single_backup_file_from_loc)
function StopVMsInOrder ([array][String]$vmNames){
#this function will stop VM's in list, sequentially
Write-Host "Processing virtual machines in order"
foreach ($name in $vmNames) {
Write-Host "Analyzing $name"
Try {
#Write-Host "...Saving $name"
#Save-VM -VM $name -wait -Force
Write-Host "..shutdown $name" #name)"
Invoke-VMShutdown -VM $name -Force #$vm.name
} #try
Catch {
Write-Host "Failed to get virtual machine $name"
} #catch
}#foreach
} #function StopVMsInOrder
function StartVMsInOrder ([array][String]$vmNames){
#this function will start VM's in list, sequentially as opposed to all at once
Write-Host "Processing virtual machines in order"
foreach ($name in $vmNames) {
Write-Host "Analyzing $name"
Try {
Write-Host "..Starting $name"
Start-VM -VM $name -wait
} #try
Catch {
Write-Host "Failed to get virtual machine $name"
} #catch
}#foreach
} #function StartVMsInOrder
function CopyFileToFolder ([string]$Source,[string]$destination){
# get filename
#################start of script##############
import-module Hyperv
#get list of running vm's
[array]$vmNames = @(Get-VM -Running | %{$_.elementname})
Write-Host "To: $single_backup_file_to_loc"
Write-Host "From: $single_backup_file_from_loc"
#call function to stop vm's
StopVMsInOrder $vmNames
if($single_backup_file_to_loc -ne " ")
#someone passed in a parameter for one-off use of script
[array]$destFileArray = @($single_backup_file_to_loc)
[array]$sourceFileArray = @($single_backup_file_from_loc)
}else
Write-Host "To Loc not Defined as param"
#get set up for what need to backup vhd's
#where back it up to
$i=0
for ($i = $sourceFileArray.GetLowerBound(0); $i -le $sourceFileArray.GetUpperBound(0); $i++) {
$tempSource = $sourceFileArray[$i]
$tempDest = $destFileArray[$i]
CopyFileToFolder $tempSource $tempDest
Write-Host "i: $i"
Write-Host "Done with vhd backup"
#call function to start vm's
StartVMsInOrder $vmNames
Write-Host "Done with vm start"
Michele ClearyI finally figured it out! I changed it so I was using the 32 bit version of powershell in TaskScheduler: %SystemRoot%\system32\.... Now it's finding the VM's!
Michele Cleary
Just FYI - system32 is x64. SysWOW64 is x86.
Don't retire TechNet! -
(Don't give up yet - 12,700+ strong and growing) -
Bash script run via cron not executing MYSQL command
I have a bash script which is run from a cron,
It is executing as I have it write to a log file which it does correctly.
I am wanting the bash script to restore a mysqldump file.
When I run the bash script manually the dump file gets loaded fine. But when I run it through the cron the mysql command appears to be ignored.
The mysqldump file is 54MB and I have checked to make sure that MYSQL is included in the global users path in /etc/profile
Does anyone know why this maybe??
Here is the bash file
#!/bin/bash
date >> /home/user/crons/crons.log
echo "Started loadbackup" >> /home/user/crons/crons.log
cd /home/user
dbuser=root
dbpass=password
dbname=databasename
filename=backup
mysql -hlocalhost -u"$dbuser" -p"$dbpass" "$dbname" < " >> /home/user/crons/crons.log
My crontab looks like
02 17 * * * /home/user/crons/loadbackup.sh
Many thanks
RichardHi Richard,
Have you tried redirecting the script output in the cron to see if an error is being reported?
I.e.
02 17 * * * /home/user/crons/loadbackup.sh > /tmp/loadbackup.log 2>&1 -
Azure powershell script runs locally bu not in webjob
I downloaded Azure commandlets locally and changed the Azure website size by just running an Azure powershell script i wrote. However, uploading it to run as a webjob on my Azure website it fails with the same errors it did locally Before installing Azure
Powersehll. Looking in kudu I see windows powershell but no azure powershell. Do I need to install Azure powershell to my website somehow?Done! >And it already got some attention :)
http://feedback.azure.com/forums/169385-websites/suggestions/7155775-add-azure-commandlets -
How do create a multi select that is one directional in a jsp page
i am trying to create a one directional multi select in jsp that is when select the option from the multi- select the first time is not appear again that is for instance if i have a status option of
NEW
Fix
Closed
they should come from the database from and if they have been selected once and save in another table they should not appear again... that is is you selec Fix you cannot go back to New... how can I accomplish that in jsp
my default is coming from on table and the rest from another reference table with for all the drop downs.Thanks. I sorted it out after a while. The problem that I was having is that Pages seemed to treat the copied and pasted webpage content almost like an image: indivisible. I had to go back to the page and copy a few pages at a time. Then I could paste the content in one page after another.
-
LOV in @prompt not allowing multi selections
Post Author: johnson77
CA Forum: Desktop Intelligence Reporting
@Select(Expense Report Line Items\ERL Expense Category) IN ( @prompt('Select Category(s) from list or key in % for All Categories','A','Expense Types\Expense Category',Mutli,free) )or '%' IN ( @prompt('Select Category(s) from list or key in % for All Categories','A','Expense Types\Expense Category',Mutli,free) )
Issue #1, The above prompt is NOT allowing multi selections from the list. (in desktop or webi versions)
Issue #2, The above prompt allows for all selection by using the % which works on desktop version, but not Webi.
Any clues to why on either of these issues.
BusinessObjects 6.5Post Author: GregPye
CA Forum: Desktop Intelligence Reporting
Hi
If the code above was pasted from the code that actually runs, then I would suggest it could be because you have spelt "multi" incorrectly... not sure if DeskI would through that up as an error, or just ignore it! -
Multi-Select Box Not Displaying Values Passed From Grid?
Coldfusion 8
I inherited an application and am trying to maintain and improve it... hit a snag today.
I have a multi-select box that is not displaying what I expect. The values come from a ColdFusion grid which is based off a database query.
Here is the code for the select - does not work - nothing is selected:
<cfselect name="USER_IDS" multiple="true" queryposition="below" selected="USER_IDS" query="ActiveUsersPlus" disabled="#disabled#" value="G_USER_WORK_UNIT_SK" display="G_USER_ID" >
</cfselect>
Now if I change the multiselect to a single select like below - it takes the first item in the field list (from the grid) and selects it in the drop down.
<cfselect name="USER_IDS" multiple="false" queryposition="below" selected="USER_IDS" query="ActiveUsersPlus" disabled="#disabled#" value="G_USER_WORK_UNIT_SK" display="G_USER_ID" >
</cfselect>
Or if I assign a variable like this and use the multi-select code it seems to work as well.
testlist = "22,26";
<cfselect name="USER_IDS" multiple="true" queryposition="below" selected="#testlist#" query="ActiveUsersPlus" disabled="#disabled#" value="G_USER_WORK_UNIT_SK" display="G_USER_ID" >
</cfselect>
I have displayed the value of "User_IDs" in the grid and in the data entry part of the screen to see values of: 22,26
to make sure that wasn't my issue.
Do grids and multiselects require something additional? Any advice on how to resolve?Problem was related to some javascript for the select box. There was a function for a single select box but not a multiple select box - this fixed it:
if(theForm.elements[i].type == "select-multiple"){
var selectBox = theForm.elements[i];
var sbname = selectBox.name;
cpvalue = String(eval('record.data.' + sbname));
var NotifyArray = cpvalue.split(',');
for (var j=0; j < selectBox.length; j++) {
selectBox[j].selected = false;
for (var j=0; j < selectBox.length; j++) {
sbvalue = selectBox[j].value;
for (var k=0; k < NotifyArray.length; k++){
if (sbvalue == NotifyArray[k]){
selectBox[j].selected = true; -
Items are not visible in multi-select listbox in a static form
Hi,
I'm using adobe livecycle designer 8.0. I have a multi-select listbox, the items are hardcoded into the form. In runtime, some of the items are selected from the server side when the PDF is generated. If only one item is selected then there is no issue. When multiple items are selected, the list box is behaving as below.
If the PDF is static,
If the listbox is readonly, then all the selected items are visible (highlighted in red)
If the listbix is editable, then it appears blank. If you select it using right click, then you can see all the items and the selected items. But if you click again somewhere outside the listbox, then the listbox goes blank. If you select it using left click, then the previous selections are gone and the items are visible with the item you just selected.
If the PDF is dynamic, then the multi-select is working fine.
Aren't the multi-select listboxes supported in static PDFs?
For your reference, I created 2 templates (static and dynamic) and populating the values using javascript in the docReady event. I'm using \n character as delimter to select the multiple items. Please find them at the below links.Notice the "List Box 1" in both forms. In static form, the values appear only after you right click the listbox.
http://share1t.com/sd4huu
http://share1t.com/hjbfr6
Thanks
RamHi All,
In such cases, please try to check as below :
1) Create Leave request work item from Employee and check the same under the UWL Tracking tab of employee.
2) Log-in to swi5 transaction of the respective back end system and give "US" -> manager's UserID -> Choose Tasks to be completed from the drop down -> Remove any date if mentioned -> Execute.
3) Here if you can see the Leave request created, but not on the portal, it reflects some portal issue like sync.
4) If no leave request work item is seen here, then there is a problem in the employee manager mapping or the workflow setup.
5) In such cases, you can try to check the Swi1 and check the log of that workflow to understand the current status of the Leave request.
Revert if further help is needed with more info.
Reward points if found useful.
Regards,
Shri vidya S -
Large Number of Multi-Select Parameter Values does not generate Report
I have a SSRS Report that requires 4 multi-select parameters.
The report is deployed on a SharePoint website with SSRS integration.
I calculated, if the user selects 'Select All' for one specific customer, there could be at most 2700 possible parameter values among the 4 parameters.
In some cases, when a user selects 'Select All' and clicks Apply, nothing happens. No icon showing Processing Report.
If a user selects 'Select All' and the total number parameter values are under 500 for a specific customer, there is an icon showing Processing Report.
I followed the instructions at:
http://social.msdn.microsoft.com/Forums/en-US/b02ccb5d-6019-4d63-bd6c-8baff24fffd8/sql-server-limit-on-the-number-of-multivalue-parameter-selections?forum=sqlreportingservices
That did not help.
Thanks in advance.Install the latest update of SQL Server :
2008 SP2 : http://www.microsoft.com/en-us/download/details.aspx?id=12548
2008 R2 SP2 : http://www.microsoft.com/en-us/download/details.aspx?id=30437
2012 SP1 : http://www.microsoft.com/en-us/download/details.aspx?id=35579 -
The Control A key is not working. I cannot multi-select my songs. I'm not sure if it is the problem with iTunes 10.6.1.7 or my PC settings encounter issues. Also, i cannot find Album Artwork online using iTunes and i cannot select any view form but List.
The Control A key is not working. I cannot multi-select my songs. I'm not sure if it is the problem with iTunes 10.6.1.7 or my PC settings encounter issues. Also, i cannot find Album Artwork online using iTunes and i cannot select any view form but List.
-
XMLP 5.6.2 - Parameters - Both Multi-Select and All-Select Do Not Work
Both Multi-Select and All-Select Do Not Work.
What's up with this behavior?
And when might it be fixed?
BG...The Multi-Select is now working, not sure what I did wrong earlier. However the "Can select all" option when building the parameter does not work as advertised, though I was able to get around that as well.
Create a Data Model
select LAST_NAME, FIRST_NAME from SOME_TABLE where SOME_COLUMN =:SOME_VALUE
OR
select LAST_NAME, FIRST_NAME from SOME_TABLE where SOME_COLUMN in (:SOME_VALUE)
Create a LOV
Name = LOV_SOME_COLUMN
Type = SQL Query
select distinct SOME_TABLE.SOME_COLUMN as SOME_COLUMN from SCHEMA.TABLE
Create a Parameter
Identifier = PARM_SOME_COLUMN
Data Type = String
Default Value = NULL
Parameter Type = Menu
Display Label = LOV_SOME_COLUMN
List Of Value = LOV_SOME_COLUMN
Option
Multiple Selection - Checked
Can select all - Checked
Refresh other parameters on change - Checked
Then test your report. Select "All" from the LOV and click view. Result - No Rows Returned.
Selecting a "Single" or "Multiple Values" values from the LOV does work.
The way I am getting around the problem is to uncheck the "Can select all" and then manually select all the values in the LOV in order to get the "All".
BG... -
Multi select prompt not defaulting
Hi,
I have a multi select prompt in the report which I have defaulted using the SQL query. Even then
the prompt is not getting defaulted. Anyone knows what can be done.
ThanksHi User,
Check ur sql again.If its fine then clear the cache of the browser and try it again.
Thanks
Diney
Maybe you are looking for
-
I have submitted a bug report to ProBoards, but they cannot duplicate the problem I am having, so I am submitting this here in hopes you can find a solution. At ProBoards Support and another PB forum while doing searches I found this problem, which c
-
LR5 "Edit as Layers in Photoshop" not working.
Been working fine up until last week or so. Now when I select the action PS opens up blank with no layers at all. I have updated all apps being used. PS is CC 2014 v.2.2. and LR5 5.7.1 Anyone have any issues like this correctly or think what it could
-
Problem printing PDF from BPM Studio ?
I'm using JasperReports to try to print a PDF from BPM Studio 10.3.2 I have tried many ways but always get the same problem: Caused by: com.lowagie.text.pdf.PdfWriter.setRgbTransparencyBlending(Z)V Caused by: java.lang.NoSuchMethodError: com.lowagie.
-
Invoice number field in Table BSEG..
I have the accouting document no.I want to find out the invoice no.Which field in BSEG table is invoice no.??
-
Hi During backup of Our Production Server, one of our table got corrupted (not getting coppied) I want to create a z table and copy the data to table So that it can be used afterwards Please let me know how to create a new table and copy the data for