Jump to content

Recommended Posts

Posted

hi guys i try to run a  script powershel.ps1   by  runwait   , but   the  answer of  script is  insufficient permition for perform action, 

but in my script i  insert require admin , why not  work???

#AutoIt3Wrapper_Compression=3
#AutoIt3Wrapper_UseUpx=y
#AutoIt3Wrapper_Res_requestedExecutionLevel=requireAdministrator
#AutoIt3Wrapper_Add_Constants=n
#AutoIt3Wrapper_AU3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

#include <Array.au3>
#include <MsgBoxConstants.au3>
#include <WindowsConstants.au3>
#include <WinAPIFiles.au3>
#include <File.au3>
#include <Date.au3>
#include <FileConstants.au3>
#include <Process.au3>


_ShadowCopyON()


Func _ShadowCopyON()
    Local $iFileExists = FileExists(@SystemDir & "\WindowsPowerShell")

    If $iFileExists Then

        ;Runwait('powershell.exe (Get-WmiObject -list win32_shadowcopy).Create("C:\","ClientAccessible") > c:\temp\ps_create.txt', '', @SW_HIDE)
        ;Runwait(@ComSpec & 'powershell.exe (Get-WmiObject -list win32_shadowcopy).Create("C:\","ClientAccessible") > c:\temp\ps_create.txt', '')
    RunWait(@ComSpec & ' /k powershell.exe -executionpolicy remotesigned  -File ShadowCopyAttach.ps1')
    ;   RunAs("SviluppoGest","workgroup","galleggiare",0,@ComSpec & ' /k powershell.exe -executionpolicy remotesigned  -File ShadowCopyAttach.ps1')


    Else
        MsgBox($MB_SYSTEMMODAL, "", "Windows Powershell non esiste devi scaricarlo" & @CRLF & "FileExist returned: " & $iFileExists)
        ShellExecute("https://www.microsoft.com/it-IT/download/confirmation.aspx?id=16818") ; powershell download for windows xp
    EndIf






EndFunc   ;==>_ShadowCopyON

content of  ps1 is

# (c) Copyright 2014,2015 Hewlett-Packard Development Company, L.P.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0

# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

param([String]$volume="")

$shadow = get-wmiobject win32_shadowcopy

# get static method
$class=[WMICLASS]"root\cimv2:win32_shadowcopy"

# create a new shadow copy
$s1 = $class.create($volume, "ClientAccessible")

# get shadow ID
$s2 = gwmi Win32_ShadowCopy | ? { $_.ID -eq $s1.ShadowID }

$d  = $s2.DeviceObject + "\"

# create a symlink for the shadow path
cmd /c mklink /d $volume\freezer_shadowcopy "$d"

echo "shadow id:" $s2

some one can help me??

thankz at all

 

Posted

Are you compiling the script? Because if you don't, the wrapper directive doesn't get acted upon.

Also, to prevent anti-virus problems, don't use UPX.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Posted

other questions, i compiled it  , but  when i run it , popup UAC and ask mi if i want run administrator  , is possible dont  ask this questions ???, because  the script  will must backup in background

thankz

 

Posted
2 minutes ago, faustf said:

is possible dont  ask this questions

No, not if you want to run it as an admin, it has to ask if it's ok to run.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Posted

do what all backup applications do - launch by a scheduled task, running under the local SYSTEM account.

Signature - my forum contributions:

Spoiler

UDF:

LFN - support for long file names (over 260 characters)

InputImpose - impose valid characters in an input control

TimeConvert - convert UTC to/from local time and/or reformat the string representation

AMF - accept multiple files from Windows Explorer context menu

DateDuration -  literal description of the difference between given dates

WinPose - simultaneous fluent move and resize

Apps:

Touch - set the "modified" timestamp of a file to current time

Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes

SPDiff - Single-Pane Text Diff

Magic Math - a math puzzle

Demos:

Title Bar Menu - click the window title to pop-up a menu

 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...